First of all, please use decent thread titles that describe your question/problem. Saying that you need help is not useful. It's better to say what you need help with.
Secondly, please write out your words in full.
Thirdly, when posting code here, put it between [code] tags to preserve indentation and aid readability.
Surely if you're learning shell scripting in a class, they must give you some resources or something to read? Have you consulted that material? You might also want to look at this
For the commands used (e.g. sort and tail), look at their man pages to see what they do and how you can use them (e.g. "man sort").