when i use document .write function and i want to when this event happen some css is working on but i can not add css while using classlist

when i use document .write function and i want to when this event happen some css is working on but i can not add css while using classlist

 varlogin=document.getElementById("login");
var sign=document.getElementById("sign")


 
login.addEventListener("click",function(){
    var name1=(document.getElementsByClassName("name")[0].value);
    var pass=document.getElementsByClassName("name")[1].value;
   
 var chan= document.writeln(name1);
  chan.classList.add("change");
   
    var chan2=document.write(pass );
    
    
});