Added logging function to template_script.sh