Meh, it happens. You're not the first person to fail the licence test twice, probably not even the first this week.
I nailed my drivers licence the first time, even on a day with really lousy weather. That should give me authorization to gloat and brag about it, right? Wrong! Less than two years after I aced the test, I pulled out from a stop sign too quickly and totalled my mom's car. And my brand new girlfriend was in the passenger seat. Even though there was no such thing as the internet back then, that was an epic fail.
A few years later, I took a college-level exam to work as an insurance broker. I had lived with a broker all my life (my dad), I knew the language and lots of the details, and I failed anyway. I got it on the second try, but that first failure still eats at me.
More than 20 years later, I'm now doing another job and was recently promoted. Very recently and after much intensive training, my boss told me to go it on my own. She said I was ready, I could do this, and she trusted me. And guess what, I screwed up not once but twice. I mean big screwups, real stuff. The whole place had to shut down completely while I figured out where I went wrong.
Did I learn anything the day I aced my driving test? No. But did I learn from my at-fault accident? Did I learn from the professional exam I failed, or those two other massive failures at work? Hell yes. We don't learn anything from our successes, we learn from our mistakes. It's been that way for over 10,000 years now, so obviously that's how our species learns.
Congratulations, you're human like the rest of us. You will fail again, and probably a few more times after that, in this crazy circus we call normal life. And as long as you learn something each time (because that's the only way we learn anything), it's actually not a failure.