The past perfect continuous (also called past perfect progressive) is a verb tense which is used to show that an action started in the past and continued up to another point in the past. Here, the speaker remained outside tilL he returned home. Hence, Option B is correct. The rest of the options do not adhere to this rule, hence incorrect.