You use a nested loop for a lot of reasons: Think about it in real life.
When you read a book, you are using a loop:
foreach page in book
But reading a page involves a loop as well:
foreach line in page
And to read a line, you need to read each word. and for each word, you need to read each character.
Computing is the same: you want to do a task, which needs you to loop through items. Each item needs further processing which requires you to loop though smaller portions.
for (i = 0; i < linesCount; i++)
char* line = lines[i];
for (j = 0; j < line.Length; j++)