When running an npm script, I get an extra blank line after each line of output.
I don't have time to test it myself right now, but I would guess you could just replace $this->line($line) with $this->getOutput()->write($line) which doesn't add any newline characters.