I had the same problem, the only solution I found that works properly is to add the start of the
to the bottom of each .tpl file and then remove the corresponding text from footer.tpl
For example:
header.tpl
homepage.tpl
footer.tpl
This way, you'll have "powered by WHMCS" in the footer of each page and you don't get formatting errors like using your current method.
P.S. You can write a quick batch script to make the modifications to the .tpl files.