Self-Doubt & Depression Do Not Make You a Better Writer
There's a subtle, but cunning divide between being critical and having self-doubt. Learning the difference is key.
Self-doubt is bad. There's simply no way it's good for you.
Being critical of your own work is good, however. It helps you to see the faults and cracks. It lets you improve.
People often conflate the two and think that because they're suffering, they're improving. Suffering has negative influence on your ability to create and work properly. Several studies have proven that being in pain (mental or physical) diminishes our capacity to learn, grow, and create.
Please don't idolize the concept of the tortured artist.
That being said, the most dangerous thing is to be over-confident. Thinking your work is the best. Your idea is the best that nobody's ever thought of. That's the real knife in the dark. It's the one most of us never see until reality claims its due.
This is the same way with music, and with programming too. Everybody only sees the end result. You don't see the hours of thought, the times you've woken up in the middle of the night to jot down some plot point that came to you suddenly. People don't see the hours of staring at words you hate, rewriting them, hating them more, and then finally moving on with a note to go back later to avoid what I call "Rewrite Hell" (constantly rewriting the same passage/paragraph/chapter over and over ad nauseam instead of continuing your story).
People only see the finished - in some cases with trusted friends, the semi-finished - work. Getting words on a page, even the most trivial, banal, tiresome tripe you can put on there is better than a blank page. You can always go back and re-sculpt, but first you need something there to improve.
Write. Write prolifically. Write crap. Write tiresome tropes. Write.
An exercise I particularly enjoy is watching a mystery or thriller. I'm a huge fan of Cosmic Horror (Elder Gods, Old Ones, etc.). One of the greatest things that horror books/stories/movies do, is they get your mind moving. You start wondering, "what is it that's out there?" and you begin to question and make up monsters all on your own.
You'll often find that your own monster, idea, or concept is superior to the one that is in the story. Take that and write about it. Flesh it out.