If you are stuck, I recommend going on a walk, giving yourself some time away from the keyboard to think, maybe even letting your subconscious think on the solution to the problem overnight, or brainstorming 10 ideas around the stuck section. You might just start writing another section of the book that you are confident about.
But being stuck presupposes that you are actually writing your book. You are sitting down and words are being typed out onto the screen by your fingers.
If, on the other hand, you are staring at a blank screen for a few minutes and then giving up, that’s not being stuck. That’s being distractable. That’s giving up too soon. That isn’t solved by going on a walk or by brainstorming. That’s solved by looking your fears in the face and calling them out. That’s fixed by telling your brain that it’s not going to stop you, that you don’t need to be protected from failure, that you’re going to go straight in and fail. Over and over and over again. And you’re going to succeed on the other end.