Re: poem
Back to the original question.
Granted, I'm in Canada, but a friend of mine was involved in a lawsuit, and I learned to my horror that the prosecuting attorney could requisition her private diaries and use them as evidence, if he thought they were relevant.
Yes, your writing can be used against you. In the pedophile case, apart from the fact that he was in posession of something which is definitely classed as illegal porn (in Canada, at least) and could have been arrested for that alone (sharing it with others has nothing to do with the charge), if he were to be involved in a case where he was actually had committed a crime against a minor, the writing almost certainly would be used by the prosecution.
There have been challenges to rulings on the basis of "artistic merit," but so far, I think, Canadian courts have ruled rather conservatively in the matter.
If I were thinking of doing such a story (and I do think it's a good story idea), I might pay an expert for an hour of her time in order to get the legalities straight.
Ruth