V + 다가 connects two related actions that occur in sequence. It is most often used with 갔다, 왔다 and 있다 – the latter translates as ‘and later on’ (lit: and then after existing):
친구가 한국에 2년 동안 있다가 나갈 것이라고 했어요.
My friend said that in two years he will leave Korea.
친구의 생일 파티에 갔다가 저는 취하도록 술을 마셨어요.
I went to my friend’s birthday party and drank to the point that I was drunk.
학생들은 교실에 늦게 왔다가 일찍 갔어요.
The students came to the classroom late and left early.
저는 초등학교 선생님 이었다가 진로를 바꿨어요.
I was a primary school teacher and then I changed my career.
시장에서 달걀을 사다가 계란찜을 만들었어요.
I bought eggs at the market and made gyeranjjim.