We have no direct evidence of what King John was thinking when he signed the Magna Carta, but it could not have been anything good. Most likely, he was feeling extremely angry and probably thinking about how he might someday get revenge. It is doubtful that he had any intention of adhering to the terms of the document.
King John was a man who believed in the innate power of kings. This is not at all surprising given the times in which he lived. He believed that he should have all of the power in the realm and he acted accordingly. This made the barons very angry and led them to rebel. The rebellion ended with the signing of the Magna Carta.
Given these attitudes, it is likely that John would have been very angry when forced to sign the document. The Magna Carta limited the power of the king in significant ways. John would not have liked this at all. As he signed, he likely would have been angry and humiliated. He likely would have been thinking about how he could reverse his political fortunes. He would have been thinking about how he could renege on the agreement and find ways to defeat the barons militarily, thus getting revenge.