The Puppet documentation
describes the format for string literals. There are multiple ways to produce a string value that contains a '$' character, but we cannot easily make any specific recommendations to you because you have not presented the problematic Puppet code. I'm inclined to guess that in your attempts to find a solution by trial & error, you made offsetting changes, and so missed finding a solution.
It its simplest, if you want to avoid interpolation being performed then using single quotes instead of double quotes to delimit your string is a good option:
$variable = 'I am assigned to $variable'
If that does not solve your problem then we need more information before we can suggest a more suitable implementation.
John