On the existence of homoclinic and heteroclinic orbits for differential equations with a small parameter