It creates a building which improves your research, but that building will only last as long as there is a mage capable of casting the spell in that city at the start of each turn.
So if your mage casts it in one city, then moves to another to cast it there, the one in the first city will be gone by the next turn (since you cannot end your turn in both tiles at once). But if you move the mage off the city to attack someone, then right back on before you end your turn, the spell will be unaffected.