This is really a criminal defense question. Apply for a public defender when you get to court. The charges sound excessive under the circumstance. You certainly have a good defense, however, the cost of clearing your name may cost you many times the cost of the repair itself.
Ask for a court appointed attorney. You definitely need an attorney. The court should appoint an attorney on the first court date then continue the case for you to meet with your attorney.
I agree with my colleagues. The charges seem excessive based on what information you've shared in your post. You need to get an attorney to handle these charges and should request that the court appoint one for you if you cannot afford one. In the meantime, since you say that the car came to you with the scratch that has been identified as happening during the incident, I would suggest that you look for any pictures you may have of the car from before that date. If you are still in contact with the person who gave you the car, it might be worthwhile to see if they would be willing to testify under oath to the existence of the scratch when they gave it to you. But definitely get an attorney. Best of luck.
This response does not establish an attorney-client relationship between the questioner and any attorney associated with Hixson Law, PLLC. Responses should be considered and used for informational purposes only. Be advised that every state has its own statutes of limitation and case law that govern the handling of all criminal and civil matters. All legal matters should be discussed with an attorney who is licensed to practice in your state prior to making any decisions or taking any actions. Please use discretion when discussing case details online or in any other public forum.