There's not really a blank line added to your document. If you look at the script file in a hex editor, you'll see that it simply ends with an
OA character - which is a newline.
So, really, every line in the file (including the last line) ends with a
newline character. I assume the editor just chooses to render that case visually with a new line, but it doesn't actually exist in the file until you add content to it.
If you look at your file in (for example)
VS Code, it'll render the same way (with a visual blank at the end).