Every no gets you closer to yes.
This is part of the process of shifting through to find the best match. If your work is good, it will find a market.
These are things authors have learned to tell themselves. Not because they are true, but because they are hopeful, and hope is a necessity to keep someone going in the face of rejection. Successful authors need to survive repeated rejection. So whatever you have to tell yourself is fine.
The real possibility of real failure also exists. No doesn’t actually get you closer to yes. It’s not a map. Yes can occur on any submission, from the first to the hundredth, or not at all. And good work is not a guarantee of anything, because “good” is an ambiguous term. It means different things to different groups. It can denote true, beautiful, or useful (and no, they aren’t the same thing). Something can succeed in being one of these and fail in the other two. Or it can fail in all three.
My point is that art can fail, and that an artist that attaches himself permanently to failed art will fail in a more complete way.
You wrote a book. Good. Now write another.