First,
$4000 is way too much for a rebuilt let alone a used transmission. You should be able to find a shop that will install a rebuilt for around $2000. Never install a used transmission.
If you can shift manually without any slippage then it is likely an electrical problem with the solenoid pack or wiring. You need to find a good shop that will take the time to diagnose your problem correctly.
jeff