Verb(ますform)がけに
Usage
がけに with the mass-stems of motion verbs like 行く,来る and 帰る means "on one's way"
Examples
会社への行きがけに銀行によって、お金をおろして行こう。
On the way to the company, lets get some money from the bank
高校生の頃は、学校の帰りがけに友達と映画を見たり、本屋に行ったりしたものです。
When I was a high school student, on the way back from home I used to go go watch a movie with my friends and go to the library.