Here's one solution that I'd use:
var div = 'blah
';
If you wanted the attribute and/or attribute values to be based on variables:
var id = "hello";
var classAttr = "class";
var div = 'Blah
';
Then, to append to the body:
document.getElementsByTagName("body").innerHTML = div;
Easy as pie.