For me, it almost always follows the same pattern. At the beginning of the book, I’m excited. I’m writing everything the way it’s supposed to written, it’s all flowing well. Then, I get to some intense scene. And I start to wonder. Should that character be killed? Should that scene be here? Should these two kiss right now? There’s a lot of danger in doubting yourself, and I know. It happens to me all the time.
I ask a lot of questions. It's how I come up with a lot of my ideas, but sometimes it take a turn for the dark side. Sometimes, I start asking myself questions after I've already started working on a project. I'll get to asking questions, and instead of writing I'm fooling around with my outline and erasing paragraphs and doing new research. This is what self doubt does to me. Self doubt is different for everyone, but it almost always has the same effect: it keeps you from writing well.
That's why I always start with an outline and give myself a structure, because I know I'll stray off the path and off the page at every possible opportunity. Writing can be frightening. Putting a book out there is scary. Self doubt is a lot easier, but in the end it feels a lot worse. It's good to ask questions, from time to time, but self doubt is dangerous. It will keep you from writing the way you need to write, and even may prevent you from writing at all.
So stop. Stick to the story, stick to the writing, and stop worrying about all the other stuff. The danger of doubting yourself is this: you'll spend so much time doing it, you won't get anything else done -- and even when you do, you won't enjoy it. You are going to make mistakes no matter how much you doubt, so don't waste your time. Just write what you want to write, and you can feel good about doing that.