If I am writing and know that somebody kind of famous did something illegal and horrible (it's a well known fact with this individual, but they were never charged), can it be put in writing or does that qualify as defamation of their name or character, which could lead to potential trouble?
Be very careful. Just because 'everyone knows' something doesn't mean that it's actually true, or that there's enough evidence for you to convince a judge that it's true when you get sued for libel.
If you're going to write something that could be seen as an attack against someone, make sure you have all your evidence to hand before you do so, and make sure that it's beyond question. Get yourself some legal advice, too, of course.
Now, even if you do have all your ducks in a row, there's nothing stopping someone from suing anyway, and the lawyer's fees alone can be crippling. If they're a little bit savvy, and you've published what you've written online (or otherwise internationally), they might even engage in a bit of libel tourism. Again: be careful, get advice from a lawyer.