So, I have a theory. The tilde is short hand for the user's home directory (try it - go to Finder, push Shift-Command-G and put the tilde as the directory) and I'm guessing some sort of app was trying to write something to your home directory but instead of writing to the home directory, it simply wrote output to a file called ~. This is just a guess though.
If my theory is right, there's an app that checks various binds (how certain software/parts of the OS are connected, or bound, to other parts). Regardless, a file named ~ is not a normal file nor is it necessary for any crucial OS component so I'm sure you'll be fine.