Clean up credential-writing code.

* Credential-writing code is all merged into a single function which
  also sorts everything.

* Writing is now done by the `sponge` program in the util-linux package.
README.md: add 1 todo item.