To not write bad fiction, first, plan your story thoroughly. Don't rush the plot. Second, create believable characters. And third, pay attention to grammar and style.
Avoiding writing bad fiction means avoiding clich茅s, doing proper research for your setting and themes, and not overcomplicating the story. Just focus on telling a clear and engaging tale.
Read a lot of well-written fiction to understand what works and what doesn't. Also, get feedback from others and be willing to revise.