This is the 6888th most frequent Korean word.
있다가
"있다가" means "later" or "after being somewhere for a while."
The word "있다가" here connects two actions where the first action is being at home and the second action is going to meet a friend, implying a temporal sequence between them.
나는 집에 있다가 친구를 만나러 갔어.
I was at home and then I went to meet a friend.
"있다가" as used in the indicated simplification shows a description of an ongoing action (drinking coffee) that is interrupted or followed by another action (receiving a call).
커피를 마시다가 전화가 와서 받았다.
I was drinking coffee and then received a phone call.
The context here indicates that "있다가" is describing staying at school for some time before transitioning to going to the library.