Erythromycin is relatively a safe medicine and can be given to infants in the appropriate dose. It does not have any lasting adverse effects once the medication is stopped. Hence there is no cause for worry.
Without extensive tests, it is not possible to determine with any accuracy whether an infection is due to bacteria (when an antibiotic is needed) or virus (when antibiotic has no role). It appears that the first doctor thought that infection was due to bacteria and hence gave erythromycin as an abundant precaution. I think he was right because one cannot take chance with such a tiny baby. My only concern would be the duration; normally a 5-day course should be adequate.