I've added some scripts in head tag using
<referenceBlock name="head.additional">
<block class="Magento\Framework\View\Element\Template" name="custom_script_block" template="Magento_Theme::script/code.phtml"/>
</referenceBlock>
All the scripts have moved at the end of page after . But the html comments are in the head tag which has in the code.phtml
Anyone knows it why?