If the freewheel just unscrewed itself, you should be able to screw it back on (right hand thread) until snug, and just pedaling force will fully tighten it, especially in the lowest gear and standing on the pedals on a hill. You really only need the freewheel tool to remove a freewheel.
My concern is that the threaded part on the hub where the freewheel screws on, may have snapped off. If so, there's no way to fix that wheel, especially with an expensive motor hub (unless the threaded part is a separate piece that bolts onto the hub).