Rendering Module Code to HTML
Clive is right that using the drupal theme system is your best bet if you're going to be doing significant variable manipulation but if you just want to load a big blob of HTML into your module you can do it a couple of ways in PHP.

For short blobs, try the EOF method

$str = &lt;&lt;&lt;EOF
  &lt;p&gt;Hello&lt;/p&gt;
  &lt;p&gt;$world&lt;/p&gt;
  ... etc.      
EOF;


For longer blobs, use file_get_contents()

$myhtml = file_get_contents(path_to_module().'/my_html.tpl');