The dynamic label can generate things like bold text, colors, tables and even remote images. What it can't do is parse invalid XHTML. If you use user input to generate a document, you will first need to validate the XHTML that goes in there. Note that not all HTML is valid XHTML, for example you will need to close img tags. Additionally, many browsers are quite lax when it comes to HTML checking and will attempt to show something even if it isn't valid, but when generating a document out of it this is not possible.
This is also mentioned at https://world.mendix.com/display/refguide4/Dynamic+label+%28document+template%29
Edit: Since you only need the exact HTML to be in a HTML file, you could simply use this code to put the HTML content in a filedocument and then offer it as a download.
// BEGIN USER CODE if (content != null) Core.storeFileDocumentContent(getContext(), fileDoc.getMendixObject(), new ByteArrayInputStream(content.getBytes("UTF-8"))); return true; // END USER CODE
This action would take a content parameter which is the HTML string, and a fileDoc parameter which is an entity based on System.FileDocument. Don't forget to import java.io.ByteArrayInputStream and com.mendix.core.Core