Why node file.js output.txt command isn’t working for me?

Actually I am new to cp ! So to read input from the files and display it on the other output file i am following this template!

process.stdin.resume();
process.stdin.setEncoding("utf-8");
//
let standardInputString = "";
let currentLine = 0;
//
process.stdin.on("data", (rawData) => {
  standardInputString += rawData;
});
process.stdin.on("end", (_) => {
  standardInputString = standardInputString
    .trim()
    .split("n")
    .map((line) => {
      return line.trim();
    });
  main();
});

function readline() {
  return standardInputString[currentLine++];
}
function print(data) {
  console.log(data);
}

function main() {
  let a = readline();
  print(a);
}

But For running this file i used “node file.js < input.txt >output.txt” this command! But then i get the following error !

At line:1 char:18
+ node template.js < input.txt > output.txt
+                  ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : RedirectionNotSupported

But the man in tutorial did the same but he didn’t get any error!
tutorial link: https://www.youtube.com/watch?v=feDyXKQkSj0 at (11:26 time)