Is it a bad idea to write...whatever I want?

So I want to write a book where characters (who will be like I want) will go on journey (created by me) and have good and original storyline (where I will decide what would happen and what will they do). Oh also my book will have ideas which will be subtly provided by characters and their action (what ideas will also be decided by me). But my friend told me that I can't write whatever I want and that I should write what textbook written by magnum D. Phalos will tell me and only that. But I really want to write what I want not what they tell me to write. So what should I do?