Why does Emacs insert ^m at the end of every line
Emacs Line Return and Windows, Unix, Mac, All That ^M ^J ^L
Q: Why does emacs show ^M in a buffer?
A: The “^M” is ASCII caret notation for unprintable Carriage return char (ASCII 13). If emacs shows that, it's probably because you have mixed characters of ^M and ^J and emacs cannot interpret them consistently as newlines.
To fix it, call “set-buffer-file-coding-system”, then give one of: “mac”, “dos”, “unix”. Then, save the file. If that does not fix it, you can use find and replace to remove it manually.
I know that this question has been resolved, but I wanted to mention that Dos2Unix is a handy part of a toolkit for file operation between UNIX/DOS/Mac machines. It is an easy command-based approach for adding/removing OS-preferred line endings.