One of the worst pieces of advice I have ever received was this – write what you know. Balderdash! How would fantasy, science fiction, and alternative histories get written if people stuck only to the things they knew?
The better advice is this – start with what you know but don’t stop there. Flesh out your knowledge as much as you can and fill the rest in with good storytelling.
Starting, but not stopping, with what you know provides a foundation to build up from. That is how science works: You figure out what you know, fill in the blanks with reasonable guesses, and see if it stacks up. Writing is the same. Start with the known and extrapolate forward.
Regardless of your view on discovery writing versus planning, getting to know your characters and their setting puts you on a firm footing. Even if you end up inventing most or all of the information, the fact that you know it leaves you better able to write about it. When you do start writing – planning or discovery – you will learn new things about your characters and the setting.
It just is not possible to write only what you know unless you exclusively write non-fiction. Write what you know is utter bunk. Starting with what you know – now that’s just common sense.