.setBody() method would set the body, not append the string to the body. So, what ever you wrote at last should be seen (that is $.response.setBody('</body></html>');). All others will be over written.
Once you run your code, check the view source . if you are at least seeing </body></html>, your code is perfect .
Check these links, you will get more idea :
How to insert data in HANA through JavaScript (with XS Engine)
Sreehari.