The most important question to ask yourself before writing a book is why. This is important because it helps determine how to proceed. If you are like me, selling what you write is important. Some people write for the sheer joy of it and others simply have something to say and have no interest in marketing. If you plan to sell copies of your book then the first step has to be determining if there is an audience for your topic. Not much point in writing a book to sell if no one is interested in the topic.
Seek the potential readers and write your book for them. The more you know about your readers the more likely you are to have a book that sells. I suggest avoiding general topics that seem of interest to everyone and target a niche group. Once you have decided for whom you are writing, the process will be much easier.