The easiest way would probably be to use the unix2dos utility:
unix2dos
$ unix2dos myfile.txt
In vim in the insert mode and type CTRL-v CTRL-m.
vim
In Vim, in the insert mode, Ctrl-V x##, where ## is the hex code of the character. In case of Ctrl-M the combination is Ctrl-V x0d.You can see the hex value of a character under cursor if you type :ascommand.