볼일 means business or something to do.
ex. 내게 무슨 볼일이라도 남아 있나요?
ex. 볼일 끝났으면 돌아가거라.
볼일을 보다 means do one's business, perform one's business, and it also can be a euphemistic way of expressing 'urinate', 'shit'
So, 볼일을 본다고[본다며] 나갔다가 would be "He went out (of the room) after saying he would go to the toilet"