This has a quotation within a quotation. A direct quotation can be stated as an indirect quotation. AT: "for Yahweh had said that you must never return to Egypt again." (See: [[rc://en/ta/man/translate/figs-quotesinquotes]] and [[rc://en/ta/man/translate/figs-quotations]])
Here "heart" refers to the whole person. An Israelite king who marries foreign wives and starts to worship their false gods is spoken of as if his heart were to turn away from Yahweh. AT: "so that they do not cause him to stop honoring Yahweh and start worshiping false gods" (See: [[rc://en/ta/man/translate/figs-synecdoche]] and [[rc://en/ta/man/translate/figs-metaphor]])