a torque sensor has 4 wires: ground, 5V, pulsed PAS and analog torque. Sometimes the analog torque output is also pulsed, but that's rare.
To simulate the torque, you need to use the PAS signal as the override cut off switch to stop the motor when the pedalling stop. For sample code, there is a...