Perhaps the biggest difference between writing and GMing is that GMing is inherently collaborative. When I write a story, I am the sole creator. I control the characters, the setting, and the plot. I am also not a collaborative writer. I have tried collaborative writing, and I'm quite bad at it. I don't like sharing my stories. But of course in a role playing game, the point is to create a collaborative narrative. The GM directs the narrative (to a varying degree depending on the group and the GM), but it is everyone's story. For the steampunk RPG that I'm currently running, I have to hold the story loosely because it isn't just my story; it's everyone's story.
And because it's everyone's story, the players may take things an entirely different direction than what you, as the GM, intended. For instance, in a recent session the players entirely avoided combat. I had not planned on this. I had plot points that hinged on combat. But the players decided that they really didn't want combat and had several exceptionally good dice rolls, so I just more or less winged it and they never found those particular plot points. In a story, I could have had someone fail to see a trap or decide to confront the villains, but in an RPG the players can sometimes avoid plot points or take things an entirely different direction.
This brings me to another, related point. When you GM a story, you are at the mercy of the dice. Sometimes players fail when you expect them to succeed, and sometimes they succeed when you expect them to fail. I had one session in which the players needed a vital piece of information from the barkeeper. This was supposed to be an easy roll, and yet one after another, they all failed it. I had a moment of not knowing what on earth to do, because I had no backup plan, before quickly bringing in another NPC. And that barkeeper who was supposed to be helpful is now a tough and acerbic barkeeper, which wasn't my intention at all. And on the other hand, as I mentioned above, the players had several exceptionally good dice rolls and managed to sneak past the Russians (twice) and then disable all the (difficult) traps, and I didn't think it would happen at all (I did manage to improvise an overheard conversation with the necessary information).
Additionally, when GMing you have to be careful not to throw tantalizing hints or clues at the players unless you are prepared for the players to go haring after them. The players don't have the same sense of what is important to the story, and they may not react how you expect them to react. For instance, I had a beautiful idea for one of my scenarios. I thought that the villain would taunt the players by telling them that their boss, someone who they trust, wasn't being entirely honest and that they should ask what happened to the group before. I liked this, but I wanted it to be a throwaway line. In a story, it could be a throwaway line and the brave heroine could respond that they implicitly trusted their boss. But I cut the line from the game because I didn't know how the players would react. They might laugh at this clear and obvious plan to distract them, or they might find it something interesting to spend three sessions looking into, and I didn't really want to spend three sessions on it.
Perhaps it comes down to control. When I'm writing a story, I have complete control. I can throw in tantalizing hints or foreshadowing, I can have the characters miss something extremely obvious, I can choreograph a fight so that they defeat a monstrous enemy or are nearly killed by a stupid mistake when fighting a small enemy. But when I'm GMing, I have to consider the players and their reactions and the arbitrary nature of dice, so that the players may ignore a plot point or interpret something entirely differently or roll poorly or roll very well, and it all affects the story. Because when I'm GMing it isn't entirely my story anymore, but something that the players (and the dice) also contribute to and shape.
*I am currently GMing (that is, Game Mastering or running) an RPG (role playing game). It is an over-the-top steampunk action adventure in a fantasy setting with elves, dwarves, vampires, and Lovecraft monsters using the Victoriana system.