You do not obtain Lugia by collecting Gym Badges. Lugia is a Legendary Pokémon acquired through specific methods depending on the game:
Note: While you don’t need all Gym Badges, completing the main story and defeating the Elite Four is typically required to access Lugia’s location.