The connective ending "-다(가)" is used to show that certain action, movement or state is stopped and changed or replaced with other action, movement or state.
이랬다가 저랬다가 한다.
이랬다 저랬다 한다.
to blow hot and cold about (something)
그는 왔다가 바로 갔다.
He just came here and has gone immediately.