This metaphor emphasizes their rejection of Moses. Alternate translation: "they rejected him as their leader" (See: [[rc://en/ta/man/translate/figs-metaphor]])
Here "hearts" is a metonym for people's thoughts. To do something in the heart means to desire do to something. Alternate translation: "they desired to turn back" (See: [[rc://en/ta/man/translate/figs-metonymy]])