Edited
Just replace "your-class" with the name of your class. See the example below:
var div = document.createElement("div");
var h1 = document.createElement("h1");
var p = document.createElement("p");
h1.classList.add("sua-class");
h1.textContent = "Me Ajuda";
p.textContent = "Preciso adicionar uma classe";
div.appendChild(h1);
div.appendChild(p);
console.log(div);
Explaining the use of classList:
The classList property returns the (s) name(s) of the class of an element, as a Domtokenlist object.
This property is useful for adding, removing, and switching CSS classes in an element.
The classList property is read-only, however you can modify it using add() methods and remove().
Refference: w3schools
If any answer has solved your problem be sure to mark it as accepted. See how and why in https://pt.meta.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta/1079#1079
– user60252