don't worry, you did nothing wrong, it's natural elimination for unhealthy baby, do a search on miscarriage, you will find it's not rare in this forum as my OB said 10-15% of all pregnancy.
I had similar experience last Feb, now I'm 32 weeks pregnant, my baby girl is strong enough that I feel pain when she kicks me.
prepare yourself for the next.
good luck