Q. Can I write my own spells?
A. You most certainly can.
People get confused about spells, thinking that there is something that makes only certain spells 'real'. That's not the case at all.
Think of it like cooking. There is no such thing as a 'real' recipe. You can get recipes out of a book, or just whip something together using your own cooking knowledge and skills. Same with spells. And just like cooking, you need to at least have some basic understanding of the techniques and ingredients or you will end up with a mess. Enough analogy. Yes, you can write your own spells but you need to do some research into it if you expect decent results.