How can I get the value from a string and write it in an output text file more than one time with it making new lines every time? So I am trying to make a demo for how to save like user input in HTML to a text file using javascript, but I am not trying to do it at the moment, I am trying to do the same thing but from the console user input using readline-sync, the problem isn't in the module or anything else, the problem is when I for example type 'test' in the console it saves 'test' to a text file, but when I do the same process with another word, let's say 'hello' it removes 'test' and writes 'hello', I tried using the \n function but it didn't help, the code is down below:
const fs = require('fs')
const readline = require('readline-sync');
var userinput = 0;
userinput = readline.question(`test\n`);
fs.writeFile('Output.txt', userinput + "\n", (err) => {
if (err) throw err;
})