Following code is returning the length of allRows[] as 3, because it has 3 arrays in it. I am trying to build one final array allRows.
  getRows() {
    return this.element.all(by.css(".xyz")).getText();
  }
  getTotalRows() {
    const allRows = [];
    for (let i = 0; i < 3; i++) {
      allRows.push(this.getRows());
      this.scrollDown();
      this.waitToLoad();
    }
    return allRows;
  }Actually getRows() is returning an array of promises. Following changes to my code has fixed the issue
  getRows() {
    return this.pinnedRows.getText();
  }
  getTotalRows() {
    const defer = Promise.defer();
    let allRows = [];
    for (let i = 0; i < 3; i++) {
      this.getRows().then((rows) => {
        allRows = allRows.concat(rows);
        this.scrollDown();
        this.waitToLoad();
        if (i === 2) {
          defer.resolve(allRows);
        }
      });
    }
    return defer.promise;
  } 
    