A few questions, because I suspect you've confused yourself:
1. Is the variable rowLength supposed to be the number of bricks in each row, or the number of rows that need to be created? I ask...