Is it better to have iftar in the mosque after praying or better to pray at the mosque then go home to have iftar with your family?.
If what the questioner is referring to is food that is eaten to distinguish between the time of fasting and the time when it is permissible to eat, such as eating dates and drinking water and so on, then it is mustahabb to hasten to do that, because the Prophet (peace and blessings of Allaah be upon him) said: “The people will continue to be fine so long as they hasten to break the fast.” Narrated by al-Bukhaari, 1957; Muslim, 1098. See also question no. 13999.
But if what is meant is what people eat after praying (the iftar meal), then there is nothing narrated concerning that in the Sunnah as far as I know, but each person must weigh up different factors. Eating iftar in the mosque with the congregation serves the interest of bringing Muslims together and helping them get to know one another and become friends, reviving the spirit of cooperation and so on.
Eating iftar with the family at home serves the interest of bringing the family together, discussing family matters, reinforcing the bonds between family members, teaching children the etiquette of eating and conversing, and so on; it increases the love between husband and wife, and between parents and children, and so on.
What the head of the household must do is strike a balance between these interests. He could choose some days to eat iftar with his family and some days to eat iftar with the congregation in the mosque, whilst noting that his duty to take care of his family and children, teaching them the etiquette and teachings of Islam takes precedence over the naafil action of meeting with friends in the mosque, because he can meet them at Taraweeh prayers or in a general gathering and so on.
And Allaah knows best.