I want to pass data to an html and write it. I try something but it doesn't work. I don't know how to do it what I wanted to do.
I pass this file from router to and ejs file:
router.post("/home/addfiles/rightside", function(req,res){        
    var paragh = req.body.paragh ;
    res.render("files/writeto",{paragh:paragh}); 
)};
Then in my ejs file I want to write the file I pass from router using js:
   <div>      
         <p id="gethisformjs"> 
         </p>      
    </div>
 <script>
    var passeddata = <%- JSON.stringify(paragh)%>
      if (passeddata){
       // here I want to write the above (passeddata) to <p> </p> by finding its id
      }
 </script>
I can use this:
document.getElementById("gethisformjs").innerHTML = passeddata;
But the above dose not write it permanently to the server. I also try to use fs write method form JS but in this method I can overwrite all the file or write the file to new line, I couldn't write the file to specific location (find by id and write).
For this method I don't want to use database because I have limited space. How can I do it? any help please.
 
    