Unfortunately this has the hallmarks (as happens here time to time) of someone who's in over their head and is trying to muddle through getting random people on the internet to do the work they've represented themselves as being capable of doing. As has played out they were able to get the first thing "working" now they're hitting another block because they don't know the basics and aren't able to apply what they don't know (i.e. the persistent syntax errors with multiple braces or no braces edit and not understanding variable scoping /edit; not knowing how to delimit variable names in interpolation or thinking there's multiple levels of interpolation as in the last "attempt" above; edit and again, not bothering to try the FAQ they're pointed at (cue the music) /edit).
The best thing would be for the OP to go back to their manager / supervisor / whomever and own up and explain they're in over their head, they're not the person to make these changes, and to be that person they need more training / to read more / to take time to actually learn how to program.
Edit: Personally, I'm at the last phase mentioned here WRT "You can't just make s<tuff> up . . .", and I'll just be kibitzing tangentially like with the concatenation vs interpolation deparse rather than trying to inculcate porcine singing.
The cake is a lie.
The cake is a lie.
The cake is a lie.