check if you have ANY blank spaces before your code in template_form.php and remove them. Also worth checking all your other files index.php, header.php for blank spaces before (and after) code. It’s a common cause for this error.
If it doesn’t, try putting <?php acf_form_head(); ?> in your header.php instead (before any code and without any spaces before as I mentioned above)
Hope this helps.