Let's start by setting something straight.
Changing your mind is not the problem
What you are after is why you are changing your mind. Looking over your work and rewriting it is a natural part of editing - you don't want to get rid of it. What you want, is to know when to stop.
What you are experiencing is called the inner critic. The inner critic is what makes us praise the work of others, while comparing our own and woefully concluding that it is horrible. Maybe it is, maybe it isn't. All the inner critic cares about is making things better, regardless of if they should be made better, or even can be made better.
In short, you need to know where to draw the line with your inner critic.
Practice makes perfect
Practice writing without your inner critic. Ignore it. Just as Aspen Rand said, write it down, regardless of how it sounds. Some people can do this better than others. If you find that, while you aren't redoing everything, you are still bogged down with how bad it is, try this:
Write something that doesn't matter. Delete it the moment you've written it. Knowing that what you write has no lasting result will instantly silence your inner critic. Do this until you have completely banished the urge to change every line.
Move things up. Write a journal. Write fake letters to fake people. Write anything, as long you are the only one seeing it. Don't delete these. Your inner critic will want to fix everything, but ignore it. Get used to writing this way.
Once you're there, take it a step further: bring other people into the picture. Start small, with texts (yes, focus on grammar and English), emails, even the post-it notes on the fridge. Now your inner critic will really kick in, but don't let it. Fix the spelling and grammar, and move on.
Gradually you will get to the point where you are writing for a lot of people. There's a lot on the line. Hopefully by now though, you know how to write without your inner critic. But don't stop there. Your inner critic is there for a reason: editing. When you've written the novel, section, or chapter, unleash it. Let the inner critic run rampant.
The problem at this point is knowing when to stop. Remember this rule: the inner critic is never, ever satisfied. If you're waiting for your writing to turn out perfect, it will never happen, according to your inner critic. There will always be things you can write better. The trick is to know if what you have written does its job. Does this passage convey the information in a clear fashion? Does this bit evoke the right emotions? Is this dialogue natural? If the answers are yes, move on. A beta-reader can help greatly here if you are still having trouble.
Always be aware
Your inner critic will never let up, so neither should you. Eventually you'll be able to write without it, edit with it, and know when to move on. Until you reach that point though, be relentless in learning to control it.
For example, my inner critic is telling me this answer is not good. It rambles. This very example might be going nowhere, or be completely unnecessary. And yet I'm still writing it. When I'm finished with this answer and have tied it up, I'll go back through and re-read it a few times. I'll fix some things, but if I feel it gets the point across and is easily understood, I'll post it.
One other thing I would like to mention: outlines. When writing something long, like a novel for instance, you do want to make sure everything is as good as it can be. The above method makes sure everything is okay, but a whole lot of okay doesn't equal something great. It equals something which is just okay.
In my experience, the majority of writers are what I call Discovery Writers. They get a basic idea of what they want, write the first draft, throw away the bad and keep the good, write the next draft, and repeat until they feel reasonably pleased with what they have. You can certainly write that way. Many do. I don't.
I am a Plotter, and I think Plotting might be a good approach for you too. Plotting involves studying writing, and learning what works, and what accomplishes what you want. I've been studying writing for several years, and in that time I've created a process - almost a checklist - which I run through before ever putting hand to keyboard.
The process creates the plot, defines the characters, ensures reader involvement, makes the story interesting, and does everything else a good novel needs to succeed. Only then do I write it.
This takes a lot of the guesswork out of writing. I no longer have to rewrite until the tension in scene A is where I want it. The outline I created included what techniques to use to create that tension. Best of all, the inner critic can't jump in, because I know how those techniques work. I know the tension is there.
Try outlining. You might find it suits you. It takes some study, practice, and trial-and-error to do it right, and your outline needs to be very detailed, but it is worth it. In fact, I spend so much time on the outline, that it takes the place of all the drafts. By the time I'm done, I know exactly what tools I need to tell my story.
I hope this helps. Best of luck in your endeavors!