Right. The problem is that because it is your file itself that being modified, rather than something that depends on user input, it may be the case that the server has been compromised, your account has been compromised, or maybe you allowed write access on shared hosting so some malicious user has been running a script that does this to you.
Besides only allowing read access to your scripts, change your password.