Yes, you included the commands you want sudo to run in the file, but you didn't do anything to cause them to be fed to stdin of the shell sudo starts. So that shell is still trying to read from the script's original stdin, not reading the commands later in the script.
...which is to say: bash somescript is not at all the same thing as bash <somescript. (Not that the latter is safe either: The shell is perfectly free to consume lines ahead of the one it's currently executing, and in many cases is required to do so, making that file content unavailable to other programs inheriting the FD).
(Adding the fact that "the script is in a file" to your question does not make this any less duplicative; the other answers still apply just as much as they did pre-edit).
killallwon't be run untilsudofinishes and exits.sudoto run in the file, but you didn't do anything to cause them to be fed to stdin of the shellsudostarts. So that shell is still trying to read from the script's original stdin, not reading the commands later in the script.bash somescriptis not at all the same thing asbash <somescript. (Not that the latter is safe either: The shell is perfectly free to consume lines ahead of the one it's currently executing, and in many cases is required to do so, making that file content unavailable to other programs inheriting the FD).