you mean in english... teacher kim when did you came in here?
i think 김 선생님이 언제 (여기에) 왔었어요...
in this case you have two past tense (do-present, did-past) (come-present, came-past)
in korean presentence verb+아요,어요,해요... i think you already know that.
so in present 오다 to come into past tense 오+았요= 왔어요...
then you have one past tense again "did" in present is do in korean 있다 past-- 었다
so thats why 왔었어요..
i hope you get what i mean?