The trade spent to gain production this way are, unfortunatley, spent and can not be used for anything else since it is the build action that is being cancelled.
How 2 players can have a constant supply of the resources needed to do the cancelling (spy) is, to me, a bit strange since there are only 6 spies in total (3 in huts and 3 in villages) in the game. This means that Writing could only be used a maximum of 6 times during an entire game. This is due to the fact that resources spent this way (incense, iron, silk, spy, uranium or wheat) are used up.
If the resources was found in a hut or village, they are to be removed for the rest of the game and can never reappear.
If the resources was harvested by one of your cities (incense, iron, silk or wheat) they are to be placed in their respective supply pile ready to be harvested again (bearing in mind that a harvestable resource that has run out in the supply cannot be harvested again until the supply is restocked).
[EDIT] Now that I think of it, there ARE 8 more possible spy resources to be gained. From the Culture cards.There are:
3 "A Gift from Afar" cards at Culture stage I,
3 "A Generous Gift" cards at Culture stage II and
2 "A Princely Gift" cards at Culture stage III.
These are also, however, used up when spent and placed in a discard pile next to the appropriate Culture Deck and are not shuffled back until the Culture Deck is empty.
At Stage I one of the 3 cards could appear a second time if playing with 4 people and all 4 players advance to the second last Stage I Culture Track space.
At Stage II each of the 3 cards could possibly appear twice each. Again, if all 4 players advance all the way on Stage II.
At Stage III the 2 cards could also possibly appear twice.
It is highly unlikely that any of them would actually appear twice though since it's very rare for all 4 players to go for a culture victory.
Also to bear in mind is that there is a way to cancel Writing being used and that is to use the LVL 4 tech Mass Media. Unfortunatley, this ability also uses the resource Spy.