ETL OrientDB creating edge only for first row of the csv


I am trying to create edges between the vertices of two already uploaded vertex classes A and B using OrientDB version 3.0.12. Class A has id1 as property where A1, A2, A3 etc. are stored and Class B has id2 as property where B1, B2, B3 etc. are stored. Below is the description of classes and their properties and stored nodes.

Class: B
Property: id2

Class: A
Property: id1

I am using a csv file (edges.csv) to lookup the relationship between A and B. A and B can have multiple many-to-many links between them. Following are few row samples of the csv file:

fromID toID
A1 B1
A2 B1
A3 B1
A1 B3

However, the problem is that the edge is getting created only for the first row of the above csv. Example: An edge is being created only between A1 and B1 in the above sample** . I am using the following JSON file to create the edge:

      "source": { "file": { "path": "../edges.csv" } },
      "extractor": { "csv": {
    "separator":"," ,
    "columns": ["fromID:String","toID:String"]
        "command": {
          "command": "CREATE EDGE relatedto FROM (SELECT FROM A WHERE A.id1 = '${input.fromID}') TO 
    (SELECT FROM B WHERE B.id2 = '${input.toID}')",
          "output": "edge"

    "field": { "fieldNames": ["fromID", "toID"], "operation": "remove" } 
      "loader": {
        "orientdb": {
           "dbURL": "plocal:../databases/demodb",
    "dbUser": "admin",
    "dbPassword": "admin",
           "dbType": "graph",
        "classes": [{"name": "relatedto", "extends": "E"}]