First things first: don't feel bad. I was among the top three students in my country and I still got rejected by all the top schools I applied to for undergraduate study. It's a great big world out there with lots of highly intelligent, highly motivated students with excellent applications, and it's only going to get more competitive the higher up you go in academia.
Second: now is not the time to worry about what you might have done differently because it'll just make you feel worse. But in six months' time, if you're still unaffiliated and want to apply again, then would be a good time to read the paragraph below.
Remember that you can't just apply to top schools. You could easily be rejected everywhere. You should also apply to schools which you are confident you'll be accepted in, as well as schools which are 50-50. Then, come decision time, you'll at least be able to go somewhere and not have a gap year to fill. "Somewhere" might not be as good as "dream school", but it's still better than "nowhere".
Third: what to do next is the most pressing thing to figure out. Doing nothing is not ideal - that makes you a burden to your caregivers. If money is at all a concern for you, I advocate getting a job. You might not be able to commit for very long (although you can delay grad school for two years or more too) but you still might be able find a temporary job. Working has many great advantages that can change your perception of grad school completely. At the very least, you'll be on a more solid footing financially when you attend.
If money isn't a concern to you, and you're dead set on doing PhD studies, then you can use the intervening year to learn more mathematics. For example you could stay put at your current institution for a year taking extra masters-level courses that you didn't take because of time constraints. You could do an extra research project with your current supervisor. You could look up the job requirements for jobs you want to do, and take the year to self-study those. You can do all these while preparing for another attempt at the Math GRE. You could even take the gap year to travel the world, which like getting a job will be a transformative experience that will teach you things you cannot learn at a university. See this related question for more suggestions.
In short, getting admitted to a PhD program isn't everything. Shake of the disappointment of having been rejected at all your top choices and you'll find there're lots of things you can do, not all of which might be related to studying but will nonetheless lead to personal growth.