Warning: air code; untested...
k=0; % row counter (or compute on fly from i,j, your choice...)
L=size(A,1);
for i = 1:N:L % over number of sets of N in A
for j = i:N
k=k+1;
if k>L,break,end % done...
A(k,:)=circshift(A(k,:),[0 -j.^N]);
end
end