The key to writing a good fan fiction could be many different things, but you definitely need to start off with a good idea, good grammar, and a good plot. There has to be something good to draw the reader in during the first few chapters :) Just write the first chapter or two and message people asking them to read it and give you suggestions on how to improve it, that's how I started! :)