Stream does not exist
The reason for the error is from this line
write(Output1,Output2)
write/2 - write(+Stream, +Term)
Output1 is unified with tiguan
and then passed to write/2 which expects it to be a stream.
If you use two consecutive write/1 it should work, I.e.
write(Output1),write(Output2).
I prefer to use read_string/5.
See StackOverflow answers. (search).
If you want to get more involved then you can switch to parsing input with DCGs but your example doesn’t warrant that.
See: Best practices for printing
HTH