Here "Israel and Judah" represent the people of all of the tribes. Alternate translation: "all the people in Israel and Judah loved David" (See: [[rc://en/ta/man/translate/figs-metonymy]])
The phrases "went out" and "came in" are idioms that refer to leading the people into battle and leading them home from battle. See how you translated this in [1 Samuel 18:13](../18/13.md). Alternate translation: "led his soldiers into battle and led them home from battle" (See: [[rc://en/ta/man/translate/figs-idiom]])