First, you cannot undo the past. You failed . . .but you scored perfect on the test that counted. Failing a test should be a learning experience and it appears that is what it was for you. If I were to fail a math exam three times, does that mean that I should never use numbers? There is no need to be embarrassed. Everyone fails at something. The choice is either you learn from it and move on or you focus on it and get held back . . . you appear too insightful not to simply deal with the issue and move on.
Second, I think that you are vesting too much power in what others tell you in terms of stories about driving. Driving is like any other skill. It takes practice which brings confidence. Here's a suggestion . . . why not consider signing up for some refresher driving course such as defensive driving? When you stop driving, then you stop reenforcing your knowledge. Take the course with a reputable school and then drive.
Third, as unfortunate as it is that your friend tried to commit self-harm, you are not responsible for anyone's actions but your own. I think that you may benefit from a bit of counseling to break the association that you have made between your friend's actions and your driving.
Fourth, being on the road is not an issue of whether you "deserve" to be there or not. It is an issue of having the skills to drive. You say that you are scared now to be driving so you need to look at counseling to understand why (you may think the trigger is your friend, but there may be something else) and a counselor can help you to understand and manage these issues.
Fifth, you do not need to make excuses for not driving. You are answerable only to yourself and if you do not feel like driving, then you do not have to drive. You are smart to recognize that you have anticipation anxiety and you are even smarter to know that you need to manage it. Do not let others dictate what you feel is best for you. At the same time, though, do not remain static. Get some help, get back on the road, and know that your issue is driving is a speed bump to overcome which I have ever confidence you will be able to achieve with a little support and guidance.
Keep in touch and let us know how things motor along for you . . .
Take care, KC