The Quran Verses
Surah 6:74-78:
And when Abraham said to his father Azar, "Do you take idols as deities? Indeed, I see you and your people to be in manifest error."
So when the night covered him, he saw a star. He said, "This is my lord." But when it set, he said, "I like not those that disappear."
And when he saw the moon rising, he said, "This is my lord." But when it set, he said, "If my Lord does not guide me, I will surely be among the people gone astray."
And when he saw the sun rising, he said, "This is my lord; this is greater." But when it set, he said, "O my people, indeed I am free from what you associate with Allah."
The Relevant Source Text (Jewish Apocrypha / Midrash)
The canonical book of Genesis NEVER records Abraham searching for God by worshiping stars, the moon, or the sun.
This narrative was invented by Jewish rabbis centuries later as a homiletic teaching tool (Haggadah) to explain logically how Abraham rejected his father's idolatry before God formally called him.
The author of the Quran heard these popular Jewish folktales in Arabia and mistakenly recorded them as literal, historical events revealed by the divine, canonizing human folklore as the Word of God.