Printing console output

what you have is

System.out.println(htmlText);

which outputs to the console.

What I suggest is

output.println(htmlText);

to write to output object (the variable name may be confusing!)