The structure …着…着 indicates that a situation occurred due to some action that was done or repeated over a period of time.
Scheme
verb
着
verb
着
就
situation
了
The adverb 就 is placed after the second verb and indicates that the situation occurs immediately after the repeated action.
The particle 了 is placed at the end of a sentence to emphasize that the situation has changed.