Honestly, no one knows how the book was created. Everyone who was involved in the books creation died horrible deaths at each other's hands and the book was lost. On the surface, it looked like just an ordinary book so when people discovered it, they just put it on their shelves with all their other books and it passed from hand to hand.
Part of why the book got passed from hand to hand was that the book itself had a bit of willpower. It was not malicious in any way. It just had a self preservation instinct so that, whenever the book felt threatened, it caused itself to become lost and then found by someone new. It also had a shapeshifting ability to help it blend in to any library. If it detected that someone was into sci-fi, it would transform itself to look like a sci-fi book so the new person would want to collect it.
Thus the book wandered all over the world repeating a cycle: The book got collected by a new owner. The book revealed its power to the new owner. The owner was very happy for a while but at some point, either the owner got too greedy or too many people knew about the book's power and fought over it. The book felt threatened and arranged to get itself lost again so it could get collected by someone new.
When the book revealed its power, it did so by revealing a page which read, "Whatever you write in this book becomes true. The power is retroactive in that all of history will change to make what you write true. You and you alone will remember what it was like before you wrote in this book. This power is limited. It is primarily to change the rules of your world such as changing societal norms or making changes to your species. It can make changes to the sun and the moon as well but it cannot rewrite the laws of physics or change the stars."
The book did not reveal some of its other powers. It did not reveal that it had the power to undo all changes and when it felt threatened, it tended to undo all changes reverting everything back to normal. (Often how the book arranged to get itself lost was by suddenly stripping power from its owner so that several owners got arrested for usurping the throne).
Also, the book could add its own text or rewrite whatever was written in it. But I repeat, the book was not malicious and only used those powers when it felt threatened. As long as the book felt safe, the book was happy to satisfy its owners every desire.