To avoid creating such inappropriate stories, one should be guided by moral principles. Think about the impact of your creations on society and individuals. If it involves violating someone's dignity or causing harm to relationships, then it should not be done. Also, surround yourself with positive and ethical influences, like reading good literature that promotes positive values and staying away from sources that promote immoral content.
First, have a strong sense of ethics. Always remind yourself what is right and wrong. Second, respect family relationships and the privacy of others. Don't let your imagination cross inappropriate boundaries.
Well, start by educating yourself on proper social and moral values. Understand that certain topics are off - limits. Also, focus on positive and healthy relationship themes in your writing or thinking. For example, focus on friendship, mutual respect in romantic relationships, etc. And always consider how your words or ideas might affect others. If it could potentially make someone uncomfortable or violate their dignity, then don't go there.