Executing TSQL script generated from SSMS in SQLCMD. Failing on quotes
$(...) denotes a variable in SQLCMD, so it's interpreting your data as a variable.

Use the -x command-line option to disable variables.