No, I don't understand what you're doing, or why you're having problems.
If you don't want HTML in the output, don't put HTML in the output.
PHP doesn't produce HTML, it produces any textual format that you tell it to produce. That might be HTML, or XML, or WML, or tab-delimited text listings, or something you might dream up. You can write anything to disk and you can send anything to the browser.
There are at least three completely different file formats that all go by the name of MIF, but as far as I can tell they all are text-based and PHP should be quite capable of producing reports in those formats.