Ever felt a book was bad? Why do you think it was bad?
It had spelling errors.
It had grammatical errors.
The characters acted weird all of a sudden.
The plot had holes.
The story jumped its way to the end.
The location/profession/etc. was absolutely nonsensical.
A few of the many reasons why readers shun a book, and finally an author.
If you want your book to sell well, remembering this one thing would help you write better:
My Readers Are Not Stupid. They Pay For My Book Because They Think It's Worth It.
Make full use of the spell & grammar checker. Hire a professional proofreader/editor.
Talk to your characters. Make them real with real reactions.
Get your book beta-read to identify plot holes that you might have missed.
Do your research. Talk to people. Don't just google.
Last but not the least, revise it as many times as possible till it has the same quality that your favorite book has.
Because your reader is not stupid. Respect your reader.