I agree with uncle.
You didn't even show that you made an attempt at this.
What kind of format are you supposed to input the information in?
For example, do you want the script to ask the user for the information? (*script says* please input the lastname. *user types lastname*)
You just copied your homework instructions and expect us to magically find a solution for you.
Well, I'll give you a little lesson on the while loop, and you can figure it out yourself from there.
the while loop is something you do to keep executing a bunch of commands over and over again if a certain "condition" is true.
The conditions can be numerical comparisons, like if $variable1 is greater than $variable2
(( $variable1 > $variable2 ))
or if a certain variable equals a certain string
[[ $variable1 == "poop" ]]
that kind of stuff.
or just the exit status of a command, such as
grep cow animalfile (if a line with the word "cow" is found in the file, it will register as 0 (True) if it is not, it will register as 1 (false). The while loop only does its stuff it the status was true.
Something you could do with a while loop is
echo "please enter your name"
read myname
while [[ "$myname" == "Jack" ]]
do
echo "Hi, my cousins name is Jack"
echo "please enter your name again"
read myname
done
The script will ask the user to enter his name. If his name is "Jack", then it will do whatever is between the words "do" and "done" over and over again, as long as his name is still Jack; in this case, it will say "Hi, my cousins name is Jack" and ask the user for his name again. If his he enters Jack, it will keep doing it over and over, but if he enters something else, it will stop asking him.
Just so you know, if it didn't ask for his name again in the while loop, it would keep on telling him forever that his cousins name was Jack. Stopping the loop is called loop control.
You want to ask the names and ages for 5 people, so you have to do whatever is in the while loop 5 times (make some variable equal to 0 and use something called a variable increment in your while loop, which adds the number 1 to a variable every time the loop executes) and in the while loop conditional statement, say that you want to do it as long as that variable is less than 5.
You'll have to use 3 variables that will accept multiple values in one variable, called an array. You should read it yourself and figure out how to do it.