Do I write what I know? Usually I have some knowledge of what I write about, but not enough, because my ideas seldom match my life experiences. So I don't write what I know, I write about what interests me.
I'm revising a new novel, Home Free, and the main character's little brother has Diabetes. I did have a student with Diabetes, and a teacher had to check her blood sugar level while she was at school, but that's been some time ago. I've forgotten the details, details that have to be accurate or it'll upset my readers.
In the novel, the family's house is foreclosed. Do I know anything about foreclosure? No. I had to go online and research it. The internet is an invaluable resource for writers. There's also a scene in a pawn shop. I've never set foot inside a pawn shop, but I have some critique partners who have, and they were quick to point out what didn't sound authentic in that chapter. Another thread in this story is a campground, and since I've camped for years, I do have firsthand knowledge on that topic.
For me, writing is exploring ideas, feelings, and universal truths. When I get an idea for a story, of course it's partly based on my own experiences, I think all stories start there. But writers have to expand on those ideas, and to accomplish this, we have to do research.