Not a single item

I wrote down the following to get data from a relationship and insert it in an item type but unfortunately im having the following error

I dont see an issue with my logic if someone can take a look i would really appreciate it.

Not a single item

Item ecrtask = this.newItem("ECR Task", "get");
ecrtask.setProperty("source_id", this.getID());
ecrtask = ecrtask.apply();

for(int i=0; i < ecrtask.getItemCount(); i++)
Item relDoc = ecrtask.getItemByIndex(i).getRelatedItem();
string title = ecrtask.getProperty("vsy_title","");
string relDocid = relDoc.getProperty("id","");

string sql = "update [innovator].[VSY_Task] set vsy_title = '" + title + "' where id = '" + relDocid + "'";
Item result = inn.applySQL(sql);