You should be able to pass an additional variable of type 'var string' around your recursive functions, and simply use add() to add characters as you go - strings in Nim are modifiable and adding to them is cheap.
When you've fully bubbled back up the call stack the result is there for you in your string.
