If you don’t follow this structure of writing HTML then you may end up in struggling for colors and adding functionality.
eg: if you have
1.1 div </div> </div> </pre>
This must be equal to writing
1st div 1.1 div
Both of these appear same when rendered in browser, but it would become impossible for developer to style only 1.1 div part
So it is helpful for developer to write HTML in DOM