So let me break this down
You cannot use document or manipulate the DOM in Node.js. The sendmail npm package only works in Node.js and cannot be used in the browser.
Also, using JavaScript in emails is a really bad practice and can even get your email rejected and ruin your spam score (the higher the score, the more likely it will go to spam or be rejected)
If you want to get the value of a form and submit it, you could use Ajax (like @RiversideRocks’s answer says) or use HTML forms as it’s a bit easier to validate if you are sending to an actual email or to INSERT INTO email_table (email) VALUES ("<script>alert('xss')</script>") (a sample XSS payload/troll answer. Also using html forms allows users without javascript enabled to use your site.