Ttc #2 missed miscarriage

I am trying to conceive #2. In dec i found out i was preg..in my 8 week appointment the baby was hail and hearty with a heart rate of 170..there was a blood clot but the doctor said it would probably get absorbed and asked for a usg at 10 weeks.. she also did a pap smear..in my 10 week appointment it showed the baby has not grown since 8w and 3 days..and no heart beat..i took the pill and am now miscarring..i am so lost..what did i do wrong mammas? Should i have not done the pap smear?