You need a variable for the created element.
var input = document.createElement("input");
input.className = 'class_to_add';
document.forms[0].appendChild(input);
Update:
.appendChild
return the child, so you could also do it with out a variable:
document.forms[0].appendChild(document.createElement("input")).className = "class_to_add";