print writes a newline character to the output stream per default (or a space between each argument). so you get two calls to write, one with "abc" and one with "\n".
so if you don't want that behaviour, you have to treat that calls separately.