add custom header in term listing tpl page
I think you're not trying to do that in the right place. The data manipulations should be made (in my opinion) in the modules part or in your template.php, not in your files.tpl.php...

If I were you, I'd proceed with Views module that allows exactly to do what you're trying to get. Answers to this question could help you to create an alphabetical pager with Views.