Unfortunately, you are not allowed to use yEd in an automated process (see "1. License Conditions" in the yEd Software License Agreement).
That said, we do offer the yFiles diagramming libraries for this purpose. The yFiles libraries provide an extensive and well-designed API for working with diagrams. The libraries are available for several platforms (Java, JavaScript/HTML, and .NET).