Can anyone write a book - probably. Can anyone write a good book - possibly. But, the first thing you need is a subject and that subject should be something you are knowledgable about; i.e., family, where you live, etc. unless you want to do extensive research on a topic that touches your heart.
There are thousands of books that teach one to write. A great place to find these books is by subscribing to 'Writer's Digest Book Club'. One of the most helpful books I've found is one called "Writer's Market" which lists thousands of places looking to publish a writer's words. Of course, this is when you get to the publishing stage after your book has been written, re-written, edited and written again.
'Writer's Digest Book Club' also offers a study course on writing where you are assigned a specific author, in sync with your interests, who will critique your work. The book Club offers such titles as: 'The Art of Compelling Fiction', 'Scene & Structure', 'Beginnings, Middles & Ends', 'Discovering the Writer Within', 'Writing the Natural Way' - I could go on and on and every book is full of the kind of advice a writer would appreciate.
A long process goes into writing a book. Most important is first getting the words on paper. That means diligently writing every day, even if it's just a paragraph or only a few lines, get your thoughts out there. Don't worry about grammar or spelling. That comes later at the re-write stage when you fine-tune your work.
Getting started is probably the toughest thing to do; the second toughest being attracting an editor enough to want to publish your book. Just hang in there if you start papering your walls with rejection slips. I don't think you'll find a writer out there that hasn't received one.