Removing an element from the list that is currently iterated does not work. At least it may skip the next element. Also the handling of duplicate APN names was broken: It would output the lines containing duplicate APN names times the number of the duplication, i.e. the exact same line would be duplicated. So use a `set` for storing apn names. Change-Id: Id54d245dc935117cd4640ae0f1f30b8608c87459