@varunaravind,
I tested your code and could add the template without any problem.
So, nothing wrong with the code.

Please try the tip given earlier in this thread (viewtopic.php?f=4&t=8059#p13845) to make sure you are accessing the modified template as super-admin (without which the changes won't get persisted).