Can my line go anywhere or does it need to be within any grouping?
No, take a look at the templates tree and see that the fragments are ordered by number as well as per VirtualHost section.
Do I need to insert it into the code or can I just stick it at the end and if I do need to insert it into the code, is this bash and should I use the echo command?
Never add to original template fragments, always make a copy in the templates-custom tree (maintaining the relative path as compared to templates/) and add your additions in this fragment. That way your changes will survive updates and configuration changes.
Well that is about 3 ways to ask the same question
so I will stop there.
Yes, most of them should have been clear if you read the information on the template system as you said you did.

IIRC you can create a directory inside the VirtualHost folder with the original fragments from the VirtualHosts folder, after modifying the template fragments to your needs you can then alter the configuration of the (virtual) domain to make it use a different template directory:
db accounts ibay setprop TemplatePath name-of-your-folder-holding-the-modified-templates