Creating backup with name of device

Hi,
I’m new at this and I need to make a script that will do backup of mikrotik device over ssh.
My idea was to do this

ssh -l username 10.11.12.13 ":global sysname [/system identity get name]; /system backup save name=[:put $sysname]"

in order to create backup with name=identity of router.
When I type in Mikrotik terminal

 :global sysname [/system identity get name]; /system backup save name=[:put $sysname]

everything works and I get my backup created.
But when I try to do it over ssh (like in first example) I get error message

Script Error: missing value(s) of argument(s) message

Why doesn’t it work? And how to make it work?

Try to add \ before $
$sysname

…“:global sysname [/system identity get name]; /system backup save name=[:put $sysname]”