Exodus 34:27

And the LORD said unto Moses, Write thou these words: for after the tenor of these words I have made a covenant with thee and with Israel.

The command to write was given in the renewal of the covenant on the mount after Israel's transgression, following Moses' intercession and God's promise to renew His favor, so that the written words belong to the restored covenant relationship. That instruction to write was part of Moses' direct education from God on the mount, preparing him to teach Israel. God directed Moses to write the words on which His covenant with Moses and with Israel was based.

The words Moses was to write included the judgments and statutes God gave him on the mount. Those specific directions set out the principles of the Ten Commandments in a clear and definite way, guiding duties toward God, toward one another, and toward the stranger so the people would not err. The following verse identifies those covenant words as the Ten Commandments.

Moses spent forty days and nights with the Lord on the mount. He remained alone there, miraculously sustained, with no one permitted to go up with him and no one allowed to approach the mount during his absence. At God's command Moses prepared two tables of stone and carried them to the summit, and the Lord Himself wrote the words of the covenant on the tables.