In Mendix cloud (I guess also for private cloud), the tmp directory will be cleared for every deployment.
So, lets say you put the template in your .tmp directory and deploy the template is gone.
You could probably save it in database and retrieve the template.
In your local machine, the .tmp directory is not deleted for every deployment. So that is the reason it works in local.