I think you are misunderstanding $xoopsOption['template_main'], and making things too complicated.
The purpose of $xoopsOption['template_main'] is to set the template which is called at the appropriate time by footer.php to display the module, using template variables which have been set by your code. You do not have to do
$xoopsOption['template_main'] = 'template1.html';
do form stuff
$xoopsTpl->display('db:'.$xoopsOption['template_main']);
.. just do this instead:
$xoopsOption['template_main'] = 'template1.html';
do form stuff
$xoopsTpl->display('db:'.$xoopsOption['template_main']);
But to get the output of a template into a variable rather than display it, you want to use $xoopsTpl->fetch. This will give you 3 ways to incorporate the contents of different templates into your output (in fact there are more ways using output buffering but let's keep it simple for the moment).
Perhaps the simplest is to have a template (module.html) which just displays the content of one variable:
<{$moduleOutput}>
In your module, you would then do the following:
$out = $xoopsTpl->fetch('db:template1.html');
$out .= $xoopsTpl->fetch('db:template2.html');
$out .= $xoopsTpl->fetch('db:template3.html');
$xoopsTpl->assign('moduleOutput', $out);
$xoopsOption['template_main']='module.html';
... or you can use different Smarty variables, doing some work in a template like this:
<h3><{$section1}>h3>
<table class="outer"><tr><th><{$section2}>th>tr>
<tr><td class="odd"><{$section3}>td>tr>table>
Then your module would do something like this:
$xoopsTpl->assign('section1', fetch('db:template1.html'));
$xoopsTpl->assign('section2', fetch('db:template2.html'));
$xoopsTpl->assign('section3', fetch('db:template3.html'));
$xoopsOption['template_main']='module.html';
Or finally, you can use the power of Smarty to the full like this:
<h3><{include file='db:template1.html'}>h3>
<table class="outer"><tr><th><{include file='db:template2.html'}>th>tr>
<tr><td class="odd"><{include file='db:template3.html'}>td>tr>table>
... then all you need to do (apart from assign the Smarty variables used by template1.html etc.) in your module code is:
$xoopsOption['template_main']='module.html';
Good luck playing around with these!