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`.

Sorry wrong wording perhaps, let me try again. You are now using a reference, but what is done in this function now looks a little different. See the lone space line in the diff and now just ``s += ' '``?