I’ve been looking for this book for about 12 years and would have first encountered it sometime before about 2007. It’s a children’s book about a lonely child (I believe a girl) who’s always writing in her notebook. One day she gets contacted by an imaginary friend, who communicates with her using the notebook, and this friend begins to teach the child magic. (I believe at one point, a potion using the wings of lacewing flies.) This imaginary friend’s help grows more and more sinister as time goes on, until they try to convince the child to burn down their school.
All help in finding this book would be much appreciated!!