Edited
Just replace "your-class" with your class name. 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 name (s) of an element's class, such as a DOMTokenList object.
This property is useful for adding, removing, and switching CSS classes within an element.
The classList property is read-only, however, you can modify it using the add () and remove () methods.
Feedback: w3schools