My bad!
I found out the problem, when I looked through the running config of the router I choose to test my script on I suddenly saw the line - security passwords min-length 8. I was using a far to simple password. When I typed a password with 8 or more characters the script could make it's magick happend.
So I tested my initial script I found that it works just fine, variables do not need to be in only lowercase.