clang-format-diff.py: pass through errors to stderr, not stdout

Also use write() for unified diff output to avoid further processing by the
print function (e.g. trailing newline).