The storyline at the end of Exodus chapter 19 is disconnected to what is immediately presented at the opening of chapter 20.
19:25And Moses went down to the people and he said to them. 20:1And God spoke all these words: “I am Yahweh your god… You shall have no other gods before me.”
What continues from here to verse 18 is the Ten Commandments. Verses 1-17 are an insert. The Ten Commandments (Ex 20:1-17) was inserted here, into the present narrative.
First, we are abruptly introduced to Yahweh speaking in 20:1, instead of Moses as the previous verse implies (19:25). Likewise, the text of the Ten Commandments abruptly stops at verse 17, where Yahweh also stops speaking, and the previous storyline continues in its own narrative voice at verse 18.
Second, the end of Exodus 19 has Yahweh commanding Moses and Aaron to ascend the mountain, but this never happens, or happens later on very different terms (24:1). The end of chapter 19 also speaks of Moses’ descent and his intention to speak to the people. But this too doesn’t happen. The next verse presents Yahweh speaking the Ten Commandments in the first person.
What this data suggests is that the Ten Commandments was a separate tradition and was inserted here in the narrative by a later scribe. From his perspective this was logical.
Through prior work on these chapters, scholars have identified the Elohist tradition in large part here. The Elohist text around which this Ten Commandment insertion was made looks to be a continuous and whole narrative on its own. This is what scholars have identified as part of the Elohist.
19:16bAnd it was thundering and lightning and a heavy cloud on the mountain, and a sound of a horn, very strong. And the entire people that was in the camp trembled. 17And Moses brought out the people toward God from the camp, and they stood up at the bottom of the mountain. . . 19And the sound of the horn was getting much stronger. Moses would speak and God would answer him with a sound. . . 20:18And all the people were seeing the thunders and the flashes and the sound of the horn and the mountain smoking. And the people saw, and they moved and stood at a distance, 19and they spoke to Moses: “You speak with us so we may listen, but let God not speak with us else we’ll die.”
Removing the Ten Commandments insertion (Ex 20:1-17) as well as the Yahwist version (Ex 19:18 & 19:20-25) reveals the above storyline.
If this is all part of the Elohist text, then originally the Elohist went from the theophany, as described above, to delivering the law code, from Yahweh to Moses, the people off at a distance. This law code is Exodus 20:23–23:19. The Redactor obviously saw this as the perfect place to insert the Ten Commandment tradition—before the Elohist law code.
Only a small fraction of this law code has contradictions with the other two law codes in the Pentateuch: the Priestly cultic legislation (Leviticus) and the Deuteronomic law (Deut 12-26). But this is not the only Ten Commandments in the Torah either….