The possibility of you getting raided depends on where you live.
When Shulgin wrote Pikhal (which he had to publish with his wife, because noone wanted to back then) he got the government puppets attention after they found his book in clandestine labs, and he got raided and later fined 25K i think, he had to pay the money and/or he had to give his DEA license or book license or something like that im not 100% sure, however the puppets said they didnt raid him because of Pihkal but because of his work in his lab in Lafayette, California. They cant raid and put you in jail because of writing a book, because that would be an attack against free speech and literature, even the puppets cant do this, however it depends on where you live and the level of corruption and interest. I'd bet in our times you'll be fine.