PDDLEGO: Iterative Planning in Textual Environments