Trying to get pregnant

P

So I’ve been trying to get pregnant for the past 7 years and every time I get pregnant I have a miscarriage. Well went to the doctor and I had something called endometriosis, so did surgery to get that off and my doctor told me he shot some dye up my tubes and go try. I tried and nothing worked so I need some help with whatever I’m doing wrong.