Not understanding logic of printing even lines

i am not able to understand the part where we have to print even line ,while(col<=row-2), i dont understand this logic and also ,why are we updating col=col+1 ;

see we are using 1 indexing
for each even row we observe that first and last element is 1
so we first print 1 then if the row is 4 then row-2 zeros needs to be printed
then again a 1
then when the entire line is printed
u need to increment the value of row
as row= row+1
so that u go to the next line