I have learnt that the purpose of us having children is pass on the mesorah. Where is the source in the torah?
It does not say (explicitly) in the Torah that this is the purpose of having children.
However, the idea of passing on our fundamental faith to our children is central to Judaism, and if this is not passed on to our children, then the idea of continuity into the next generation is lost. What, indeed, is the purpose of having children, if not to continue the Jewish tradition from one generation to the next.
This theme is demonstrated by the rulings of several poskim, whereby if a person’s children convert to a different religion, he does not fulfill the obligation of begetting children (peru u’revu).
See further Bereishis 18:19 concerning Avraham Avinu’s passing the tradition and faith to his children.
It is also noteworthy that a central mitzvah of Seder Night, which celebrates our national birth out of Egypt, is to pass on the experience to our children. This concept is thus expressed as fundamental to the nation of Israel.