Hi,
To connect 2 shapes exactly to the fields (plugs) you want you should connect the plugs of the erm connector to the proper ports of the shapes:
edge.StartPlug.Connect(port1);
edge.EndPlug.Connect(port2);
It depends on your data and goals, but most users prefer using the Layered Graph Layout (with a direction set to LeftToRight) for automatic layout of ERM diagrams.