Single quote behave normally but double quote is replacing the "$$" character with pid of open shell and "$<some text >" would not print anything as if it acting as a comment. Basically the problem is that double is parsing some of special character which it should not.
In the attachment you would see hash having "$" in between then and is being parsed as mentioned above and hence does not write anything in file.
Thanks and Regards.