How to run script after template has been created?

I don’t have an answer to your question, but you may want to read the tips for formatting code to make your post easier to read.