People Don't Buy Books Because They're Written Well ...
Have you ever wondered... Why do some books sell, even though they're atrociously edited and spilling over with purple prose and adverbs? Have you ever wondered why excellent stories languish on the shelves (physical and virtual) unsold? And yet some books do sell well that are excellent stories with impeccable editing. There doesn't seem to be any relation at all between whether a book is "good" and whether or not it sells.
People don't buy books because they're written well
Sorry, but they just don't.
People buy a book because they think they'll like it.
Those are not the same thing at all. The question is, what makes people think they'll like a book?
We could guess about this all day, but I think I've got a handle on at least some of the factors that go into likability:
The cover offers the promise of a good story inside
The title is both descriptive and intriguing
The description/blurb appeals to the reader
Other people (especially other people the reader trusts) rate it and review it highly or recommend it via word of mouth
The book is in a genre/niche/kink the reader already knows she likes
The book is by an author the readers already likes
The book is on sale or free
The reader has read and liked the preview of the book's actual text
Notice that only one of the above points directly deals with the quality of the writing or editing.
People buy a book because they think they'll like it
Most of why they think they'll like it has nothing to do with what I as the author think of as "good writing." That doesn't mean I'm off the hook from writing the best story I can. I couldn't do otherwise. But from where I'm sitting, this explains why "bad" books sell (except for when they don't) while "good" books don't sell (except for when they do). If we instead think of it as books people like enough to buy over other books, that gives us a fairer and more realistic map to try and navigate.
So if you want to write a book that sells, it seems to me that all of the points above are worth your time and effort. You have to battle against your budget and your own stupid human nature, which will either delude you into believing you're better at these things than you really are, or convince you all is hopelessly lost. Neither are true.
Here's a tip: if your covers don't look at least somewhat similar to the covers of books similar to yours, you need to adjust your course. If your blurbs don't read like the blurbs that make you want to buy books, you're off the mark. The other stuff is all marketing. All of these things you can google and study further to improve your indie publishing success.
Writing well is only the first and least part of the whole
Writing is hard enough already and most of us are very willing to work at that. Being an independent publisher, not so much. Except... that's actually most of your real work, the work that makes books sell and puts food on the table. So if you don't do it, or don't try to improve at it, you don't really have a right to expect sales or to complain when you don't sell books.