Don't try to output HMTL from servlets like that.
Use a JSP for the presentation. After collecting the results from a helper class whose methods are called from the servlet, set the results as...