If you want to add header in your custom mpdf and repeat the header for every page on mpdf then simply put the below code in your code and you can get the dynamic header in your generated pdf.
Step 1)
put the below code to your mpdf.
<htmlpageheader>
{Header title}
</htmlpageheader>
<sethtmlpageheader name="MyHeader1" value="on" show-this-page="0" />