Your problem is that browsers ignore white space in content. Multiple spaces and new lines are all collapsed down into one space in the rendered output.
If you want to preserve all of the original formatting, with indents and line breaks, you could output the text into a <pre>
block inside that div.
Your other option is to encode the white space into html entities. Use <br>
for line breaks and
for spaces that should be preserved.