Suppose a person had a Sefer Torah written in order to fulfill the Mitzvah (Devarim 31:19) and then the Torah got lost, has he still fulfilled his mitzvah, or is he required to write another one?
Minchas Chinuch (mitzvah 613) discusses this. He starts by citing the wording of Rambam that the mitzvah is "to write a sefer Torah," which would imply that once that's done then the mitzvah has been fulfilled no matter what happens afterwards (as in zaq's answer). However, he then cites Toras Chaim, who says that no, in that case the person would indeed need to write another sefer Torah - and quotes in support of this another statement of Rambam (Hil. Melachim 3:1), that if a Jewish king wasn't left a sefer Torah by his father, or if it was lost, he has to write two (one for the regular mitzvah like any other Jew, and another as one of the special mitzvos of a king).
Further on that page, though, Minchas Chinuch takes issue with this position, and argues that indeed there is a difference between a king - whose mitzvah is to have a sefer Torah - and a commoner, whose mitzvah is to write one (and once that's done, it's done).
Once a mitzvah is fulfilled, it's fulfilled. For instance, if you make a brucha and light candles for menorah and the candles blow out before the proper-length of time, you don't need to relight them as you already fulfilled the mitzvah as soon as you lit them.
In this case, the mitzvah was fulfilled the moment he or the Sofer wrote the first letter.
Rambam, Mishneh Torah, Hilchos Sefer Torah 7:1