Powershell generating unknown character when echoing to file
Try using set/add-content instead of redirection. You might also need to set the encoding.
"#Generated" | set-content psftp.scp -Encoding Ascii
"put test.txt" | add-content psftp.scp -Encoding Ascii
"quit" | add-content psftp.scp -Encoding Ascii