Updated loops to download and apply up to latest patch

First loop downloads patches until it is unsuccessful (404).  Second loop applies all patches that were downloaded.