You are asking the question referring to a third person's scenario. Hope it is not a hypothetical or theoretical question.
You say the Lender sold the surrendered vehicle. Did the borrower write a letter to the Lender mentioning that he was surrendering the vehicle and obtain a receipt from the Lender with the date and time of such surrender duly mentioning the Vehicle Number?
If so there would not be any problem. Even if the borrower merely handed over the vehicle to the Lender, it is the responsibility of the Lender to given borrower proper receipt giving full details of the vehicle, date, and time of such surrender
Whether the Lender followed the above procedure?
Then you borrower has no problem whatsoever as nobody can claim damages from him if the accident happened subsequent to the date and time of surrender.
In case the Borrower does not have any ack from the Lender, it is better the Lender is approached to give full details of the surrender of the vehicle, subsequent sale with dates and times duly mentioning for each event ie. accepting the surrendered vehicle and later selling the vehicle.
In case the Lender is not cooperative when Court Summons are received and/or Police call the Borrower, the Borrower has no alternative but to file his version before the Police/Court with full details of the vehicle being seized by the Lender and subsequent sale duly requesting the Police/Court to make the Lender as one of the parties in the case.
When there is a case for compensation in a vehicle accident, surely there shall be Police Case. In such a Police Case, the name of the Driver at the time of the accident shall be recorded, which also shall be in favor of the Borrower, provided his version of surrendering the vehicle to Lender prior to such accident is correct.