apt install -y package
this would work but that way you have to write it in every command
try
yes | sh file.sh # this way you do not have to confirm on every command