univalue: make spaceStr thread-safe

Simply add spaces to the existing string instead of using a temporary.

Fixes #4756.

Tested with `src/bitcoin-tx -json -create`.

Oh I see what you mean now. But it seems correct: the old loop adds spaces in units of 16 and then does a substring, but there is no point in doing that in the new case which only adds as many spaces as requested.