Not enough detail to give much specific help, but:
The last part implies there is a wiring fault, probably a wire broken at the point the cable enters either throttle body or wherever the cable goes at the other end, or if there are connectors at the point where the cable enters those, or inside the connectors themselves. Can't say much else about that without knowing exactly where in the "wires" that moving them causes a change in operation.
It's very likely that it is not the ground wire, since if that breaks it usually makes the system go full throttle for teh many poorly designed controllers without protection against that. If that's not what happens, then it's probably the signal wire, or the power wire (if it has one; hall throttles do but some potentiometer throttles do not).
The "only works now" part implies it did work correctly at some time, and after some event it begain to fail...if you ponder on the events around that time, you may be able to figure out which of them was directly related to the problem, and use that to help you locate the fault.
Also, I moved your thread from Bike Mechanical & Structural (wierd place to post it) to EBike Troubleshooting (assuming that it's a bicycle and not a motorcycle, scooter, treadmill, boat, tractor, surfboard, skateboard, airplane, car, truck, etc., since you don't say what the throttle operates when it does work).