I think the reason it didn't work is because @year@monthno should be @year + @monthno.

But nonetheless, building out shell statements is a good idea, imho. Another good idea is to run it at the command prompt first, ensure that it works like you want it to and then add it to your script.