missing ) after argument list.
You don't need to avoid apostrophes, just "escape" them. The backslash (\) character tells the interpreter not to treat the character as a delimiter. Here's how it looks in code:
window.document.write('It ain\'t me babe.')