I’m confused

Hi! So last time I posted here, I said I was on a diet and ate only 200-900 something calories a day. And it has been a week or two that I have been trying to eat more to supply my body its needs. After those said weeks, I’ve gained 9 lbs!! I was alarmed, still am, and I am tempted to go back to my unhealthy diet, despite knowing how bad that diet is. I did Fitness Blender vids at least 3-5 times a week, depends on what my parents plan since I am on vacation. I also started jogging every morning and doing HIIT at the afternoon. I ate some “no-no” foods like chocolates, chocolate bread and stuff, but I ate it in moderation. I still count my calories but I make sure I eat at least 1500 calories maximum a day. This might sound unimportant and all, but I really need help to know what I’m doing wrong, how to make those wrongs right, and what I should do from now on to lose weight and feel great. I am willing to do whatever it takes to be healthier physically and mentally and stop torturing my body. Thanks!