Add elements dynamically to an initially empty list recursively