This is wonderful writing advice. Write what you know.
It may not mean what you think it means, though. It doesn’t mean you have to write about your school, your job, your family. It doesn’t have to be set in your town or your time period. If that was the case, we wouldn’t have science-fiction, time travel, fantasy, historical fiction or alternative history. Heck, we wouldn’t have interesting stories.
What it means is use your own experiences, your own relationships, your own understanding of the universe as templates within your story. It’s the only way for your story to be “true.”
What would you do, or your sister do, or your friend, enemy, teacher, uncle, do in that situation? How would they react?
There is a dance to most relationships, and that dance can be applied to paper heroes. Imagine the dance between you and your spouse, or a prickly sibling. What if a captain and commander echoed those dances?
People of the past in historical settings may have conditions pressing on the dance, but by including the modified dance, it feels true to us (or will to you, and therefore to us, because you write with understanding).
So write what you know about human interaction, and for everything else research, research, research!