Q. Why doesn’t the book of Luke mention anything about Mary and Joseph taking Jesus to Egypt?
None of the gospel writers are attempting to present a comprehensive account of Jesus’ life, like a modern biography. Rather, they are all selecting and arranging episodes from his life in order to accomplish particular purposes of their own.
Matthew, for example, wants to give particular emphasis to the way that the good news about Jesus is for people of every nation. And so, for example, he includes the account of the Magi coming from “the East” to worship Jesus, while the other writers do not. It makes sense that he would also include a description of how Jesus actually lived in another nation for a time.
Luke, for his part, is writing for educated Greeks within the Roman Empire, and so he includes a long account of Jesus’ journey from Galilee to Jerusalem during which one person after another comes up to Jesus to ask a question or pose a problem, and Jesus responds with divine wisdom. Most of the material that is unique to Luke is found within this journey section, and most of the material within the section is unique to Luke. So we can tell that he has included it with a particular purpose in mind, that of introducing Jesus to wisdom-seeking Greeks.
Luke may well have known about the journey to Egypt. Some of his material seems as if it could only have come from Mary, or at least from people who knew her and passed along her recollections. Those would of course have included the time in Egypt. But as I said, Luke is selecting and arranging his material for a particular purpose, and apparently he did not feel that it was necessary for him to tell the story of the journey to Egypt to achieve that purpose.