When used before the verbs 来る(come) and 行く(go), the te-form of intransitive verbs expresses the manner in which the moving(i.e., coming and going) is performed. Viて 来る indicates that someone/something, which is the subject of the sentence, approaches where the speaker is. Viて 行く indicates that someone/something, which is the subject of the sentence, goes away from the place where the speaker is.
犬が こちらへ 走って 来ます。
A dog is running toward me.
人が わたしの いる へやから 外へ 出て 行きました。
Someone went out of the room where I was.