Verb of movement can take を to express the idea of moving about within that space. So here, 外を歩いている expresses the idea of "walk around outside". In a similar vein 空を飛ぶ means "to fly through the sky".
外に歩く isn't quite grammatical in the sense which you seem to have in mind; instead it means "to walk toward the outside". It would be better to say, 外で歩く but it doesn't have quite the same feel as 外を歩いている. 外で歩く seems to suggest that there are other places where you could have chosen to walk--maybe you're at a convention and you could walk inside the convention center or outside. But, 外を歩いている carries a connotation of walking about outside with perhaps no particular destination in mind.