Because if he took time to recuperate then the longer the souls stay in the afterlife, by the time he has regained his strength, the amount of chakra needed would be greater than before since the dead had spent a considerable time in the afterlife, and given the number of souls he had to revive factored by the prolonged duration of their demise, it would most certainly have killed Nagato and his full chakra may not be able to revive those many it is therefore a calculated act in his part to revive them when the fatalities were just recent to ensure 100% success, and he was not able to revive Yahiko before because he had not awaken the Rinne Tensei power during the early stages when he just acquired the Rinnegan, and even when he did awaken that power he still wouldn't use it on Yahiko, since his conversion to the side of good was just before his death, it would be impractical for him to revive Yahiko at the cost of his life when he was adamant in pursuing Akatsuki's goal.