In this case there are two options.
1. The buyer can get the policy transferred in his name by applying to the insurance company in which case an endorsement is made to the policy. However, the no claim bonus(NCB) on the policy is not transferred and the difference has to be paid. NCB is retained by the seller.
2. You can cancel your policy and the buyer can buy a new policy. You will get a refund for the unexpired / unused period provided there is no claim on the policy. In this case too, you can retain your NCB and transfer it to your new insurance policy if you have purchased another vehicle. The buyer can transfer NCB in his previous policy to his new one. Please note that your policy will be cancelled only if the insurance company is provided with the proof that the vehicle is covered by another policy.
Also you can transfer the policy to your new vehicle and the unexpired premium amount can be adjusted accordingly.