No, it had nothing to do with not taking care of yourself. That pregnancy was doomed if it was indeed ectopic. Did your doctor explain what an ectopic pregnancy is?
from
Ectopic Pregnancy --
There is no way to save an ectopic pregnancy. It cannot turn into a normal pregnancy. If the egg keeps growing in the fallopian tube, it can damage or burst the tube and cause heavy bleeding that could be deadly. If you have an ectopic pregnancy, you will need quick treatment to end it before it causes dangerous problems.
I wish you the best in getting pregnant again.