According to what I read:
During the time known as the Burning Times or Witch Trials, witches were persecuted and killed just for being a witch and practicing magick. If someone was suspected of being a witch, they were tortured, put in jail and/or killed. In order to keep the tradition of Witchcraft alive, witches would only practice underground. That means they would only practice in secret, so that no one would know they were witches. They wrote down their history, their rituals, their thoughts and anything else that might be helpful for future generations of witches to keep the tradition alive. That's why it is called a Book of Shadows. Because what it contained was a secret.