As with many things in modx there are many ways to do many things the quickest but most nasty way is copy the code you have into a new snippet.
Change
echo '<h2>Thank you!</h2>
<p>Thank you for filling out the form!</p>';
to
return ('<h2>Thank you!</h2>
<p>Thank you for filling out the form!</p>')
and
echo '
<h2>Lovely Form</h2>
<form id="quoteForm" method="post" action="'. $_SERVER['PHP_SELF'] .'">
<label>Frist Name *</label>
<input type="text" class="required" name="firstName" value="'; if(isset($_POST['firstName'])) { echo $_POST['firstName']; } echo'" />
...etc...
<input type="hidden" name="token" value="'. $detailsToken .'" />
<p><input id="send" type="submit" name="submit" value="Submit" /></p>
</form>'
EDIT ok that code needs more work but to display somthing you just return it from the snippet instead of echoing.
to
'<h2>Thank you!</h2>
<p>Thank you for filling out the form!</p>';
} else {
return ('
<h2>Lovely Form</h2>
<form id="quoteForm" method="post" action="'. $_SERVER['PHP_SELF'] .'">
<label>Frist Name *</label>
<input type="text" class="required" name="firstName" value="'; if(isset($_POST['firstName'])) { echo $_POST['firstName']; } echo'" />
...etc...
<input type="hidden" name="token" value="'. $detailsToken .'" />
<p><input id="send" type="submit" name="submit" value="Submit" /></p>
</form>')
I personally would look at using place holders and chunks see
http://rtfm.modx.com/display/revolution20/Templating+Your+Snippets
For more info on snippets see
http://rtfm.modx.com/display/revolution20/Snippets