Assuming that the car is a standard, you should first fully push in the clutch and then slowly press down the pedal, or pull up the handle, of your emergency brake (depending on what type you have in your vehicle) until you slow down to a complete stop.
car starts but when i put it in gear it stop
Maybe car is in park.
Simple, stay calm, put the gear selector in neutral, coast to the safest place you can find, stop the car, turn off the key. Have the car towed to a repair shop and don't drive it until it's fixed.
Automatic or manual trans? What am I missing here? Explain! If it is stuck in 3rd gear then it is obvious that it can't go in reverse.
Turn the ignition off.
Bogged down or mired.
Consult online forums for your car. If that doesn't help try and play about with the gear selector the see if it will budge.
Gear shifting has little to do with batteries, or your car's electrical system. If your car is stuck in one gear, your clutch (on a manual) or even worse, your transmission, might be going out. The dead battery might be just a coincidence.
Your car engine will stop.
It is being put in to limp in mode. The computer has detected a problem, get it checked out with a scanner
Because the car is not moving
the gears are stuck