Almost drowned today, Help please!

The title is true, I will tell you what happened but first I need to say that I am experienced in skateboard and snowboard to give you some idea that although I am surfing beginner, I still have a decent balance.
Recently I moved to French coast and bought a 9 foot long board Yoohoo! I thought.
Well, I figured I could self teach myself with internet here and there and learn at my own pace.
HERE IS WHAT HAPPENED
My endurance sucks! I am a web developer...
1st I reached the lineup and then got carried in a way that I couldn't reach the shore. I was not getting too far either so not too panicky but still, my shoulders were f***ing sore and I got really exhausted.
Then I managed to make it to a group of surfers waiting for some waves too big for me, about 2m. Being an exhausted beginner, I felt bad to be in this spot!
By then I couldn't even paddle to get myself surfing, just too tired.
Then one big wave was about to break on me, me facing the shore, this was bad as if I get it right, I should have been duck-diving it right? But no time to turn 180!!!
No need to say I panicked and already when the second one was ready to hit me the same way again I was even less ready. Leash trapped my legs under water. Got a feeling of almost drowning there trying to reach some air to gasp.
A third one (white wave) took me, lying on my board at fast speed, I was making some progress towards the beach when all of a sudden I got projected under water (I guess I was too forward on it) I almost died there. Miserably got my sorry ass on the beach and puked a couple times.
Please give me some constructive advice, I need to know why I messed up so bad except for my body was not fit enough which I now know.
Recently I moved to French coast and bought a 9 foot long board Yoohoo! I thought.

Well, I figured I could self teach myself with internet here and there and learn at my own pace.
HERE IS WHAT HAPPENED
My endurance sucks! I am a web developer...
1st I reached the lineup and then got carried in a way that I couldn't reach the shore. I was not getting too far either so not too panicky but still, my shoulders were f***ing sore and I got really exhausted.
Then I managed to make it to a group of surfers waiting for some waves too big for me, about 2m. Being an exhausted beginner, I felt bad to be in this spot!
By then I couldn't even paddle to get myself surfing, just too tired.
Then one big wave was about to break on me, me facing the shore, this was bad as if I get it right, I should have been duck-diving it right? But no time to turn 180!!!
No need to say I panicked and already when the second one was ready to hit me the same way again I was even less ready. Leash trapped my legs under water. Got a feeling of almost drowning there trying to reach some air to gasp.
A third one (white wave) took me, lying on my board at fast speed, I was making some progress towards the beach when all of a sudden I got projected under water (I guess I was too forward on it) I almost died there. Miserably got my sorry ass on the beach and puked a couple times.
Please give me some constructive advice, I need to know why I messed up so bad except for my body was not fit enough which I now know.