First off, that you spent six years of your life pursuing your passion shows tenacity. That you knew when to cut your losses shows good sense. I know it's disappointing that things didn't work out, but there's nothing to be ashamed of in failing to start a career as a novelist. It's a brutally hard and arbitrary industry, and any worthwhile employer should be able to recognize that.
Now, you've taken some good first steps in shoring up your technical skills. Go over the usual interview prep books (Cracking the Coding Interview, Programming Pearls, etc.) and start applying to entry-level jobs. See if you have any friends in SE roles that might be able to get you an "in" at their companies. If your university has a solid alumni network, it might be fruitful to reach out to someone in your class. If you had a good relationship with any of your former CS professors, they would be a good resource, too.
You should also consider applying to programming-adjacent positions, ie. those that make use of your CS training, but don't require you to program all day. Good technical writers are in short supply. A role as a program manager might be in your wheelhouse, too. Think outside the box in terms of industry, too. There are good, rewarding, technical jobs outside software firms. (Thanks to @JoeStrazzere for thinking about this in the first place)
Also, it might be a good idea to talk to a counselor, a therapist, or even a family member or friend re: your self-confidence. There's no shame in reaching out to others for help when you're down. Your technical skills will return and even improve with practice, so it would be worthwhile to start a toy project, contribute to an open source project, or even just do some practice challenges on prep sites (eg. HackerRank, LeetCode, etc.).
Best of luck!