How to create a element and then make that element draggable across the page?

I need to create a element with documet.createelement and make it draggable. Here is the code

    var files= document.getElementById('texttouse').value;
    let textadder=document.createElement("p");
 let t= document.createTextNode(files);
 textadder.appendChild(t);
   document.getElementById('gallery').appendChild(textadder);
     for (i = 0 ; i < textadder.length; i++) {
    textaddder[i].onclick = function() {
      var div = this.parentElement;
     
    }
  }             
  
}

But I can’t figure out how to make it draggable.Please help me.