This is a good question and one that is important to have clear.
Like Joel mentioned to you in the comments, tradition teaches that Moshe received the entire Torah including its oral teachings at Mount Sinai.
But together with that is the idea mentioned in Midrash and according to many, like the Vilna Gaon for example, that prior to the giving of the Torah at Sinai, the letters were all continuous, without breaks. It was via G-d speaking the words to Moshe that the proper breaks and reading became fixed (for us).
But in a historical context, much of the teaching was already present in the continuous format. This is what was taught, for example, in the Yeshiva of Shem and Ever, which the Avot attended as did Moshe Rabbeinu according to Midrash.
It is in this context that we also learn that the Avot, meaning Avraham, Yitzchok and Yaacov, kept the entire Torah prior to its being commanded to us at Sinai. They had access to it and knew it.
This same teaching was also passed down via Chanoch and Metushelach like is found in Sefer Chanoch. It was also recorded in Sefer Noach, what Noach learned with his sons in the Ark. And the same tradition was passed down to Noach from the teachings which were received by Adam after the sin of eating from the fruit of the Tree of Knowledge of Good and its opposite. That teaching is recorded in Sefer Raziel HaMalach, also called Sefer Toldot Adam and the Book of Primordial Man.
In Midrash, this same angel is the one who came to teach Avram (Avraham) when he was a very young child. This is indicated via the identical gematria for the names Avraham (אברהם) and Raziel (רזיאל). And it is also the same number for all G-d’s positive commandments in the Torah, namely 248, which correspond to the limbs of the male body. This book is called Sefer Yetzirah.
It is also related to the spear (רמח) used by Pinchas at the sin of Zimri and Kozbi. Zimri sinned via defilement of the Milah, the sign of the Covenant between G-d and Avraham. And according to Midrash, that is precisely where Pinchas thrust the spear.