Thanks, indeed with nano I can reproduce this.
One way to check how the editor behaves is to run
ls -li run.sh
before and after editing the script. The first number in the output is the inode of the file; if it stays the same then the file was overwritten.