Could erythromycin cure phimosis?

No its an antibiotic. Erythromycin is an effective antiobiotic for certain Gram +ve infections eg Staphlococcus or Streptococcus. It will do nothing to correct phimosis other treat an infected foreskin which causes swelling & temporary phimosis. Treatments for phimosis are prescription strength steroid cream applications or surgery. Circumcision or prepucioplasty. Latter is foreskin preserving.