Normally you do not have the right to hand the car back, at least not until half of the repayments have been made. I would strongly urge you to check your specific agreement.!
You should apply for a settlment figure firstly on the outstanding finance figure and seek their permission to sell the car for at least that settlement figure (hopefully - any excess is yours), whilst the car is on hire purchase it still belongs legally to the finance co.....until the last payment has been made.
If there is equity; then the car can be sold subject to the Finance company giving approval and being settled in full directly out of the sale proceeds.... if no equity exists in the car, then they would not allow this sale unless you have other means of clearing any anticipated shortfall.