In my experience, and from what I've seen on this site, if you are going on and off diets and not really sticking with anything it's probably a combination of things: a) you aren't mentally ready to commit to a diet and/or lose the weight or b) you aren't eating things that are satisfying you so you go back to old habits.
I think people underestimate the degree to which your brain really controls the weight loss. It sounds silly, but a lot of people who are "wishing" to be skinny have reasons to hold onto extra weight. It's like a shield or the built-in excuse we use for everything else. Or maybe we aren't quite ready to change things because, at the time, we need the emotional support coming from food.
Since my daughter's been born I've been half-a$$edly starting to "eat healthy" but I fall off the wagon in a day or two. Last week I KNEW I was ready to really commit for the next few months and put all of my effort into shopping, meal-planning and tracking my food. After I had my son, I discovered a new way of eating that made me feel good and I'm ready to get back to that.
If you want to lose weight, but you haven't stocked up on healthy things that taste good and make you feel satisfied then you are dooming yourself! Also, everyone messes up. You have to forgive yourself and move forward instead of letting it be an excuse to backslide. You can do this.
Whether you think you can, or you think you can't--you're right.