I assume this means that you had the script editor open, so you ended up doing an unwanted edit to the script and then saved it? If so, this would be affecting only the scripts you had pending edits at the time, and/or the script being viewed had an unwanted edit into it.

Can ;you confirm this is only happening with some scriptfile not others?

If so, it would be hard to identify what's wrong with the script without seeing the code. The most likely cause is the ENTER key hitting something which caused a script line to be chopped in half, following by the ESCAPE key bringing up the prompt to safe changes, followed by the ENTER key confirming it