We know of the Hadeeth about the works of the Children of Adam whose recompense continues even after their death. This applies even while the person is alive. Thus, we should not belittle or ignore things like teaching people how to pray and how to carry out their obligations, teaching them obligatory knowledge in general, and so forth. All that is passed down of this knowledge to others, its recompense will also be written down for the one who originally taught it. So it is not like that only by writing a book which will be read after we die we are going to gain benefit in the Barzakh and the Akhirah.