Once you catch a Legendary, it's gone. If you run or KO it, it can be encountered again. Try to find wormholes of every colour but white -- those ones only have UBs. If they have a flowery effect around them, a Legendary is guaranteed.
Once you find the Legendary you want, save in front of it. If it's shiny, well done. If not, soft reset and try again and again until it's shiny.
Note that sort resetting only works for Legendary Pokemon. Regular wormhole Pokemon have their shininess determined the moment you exit the wormhole.
Source: Experience
Hope I helped!