Well, have you attempted anything so far? This isn't a homework assignment, by chance, is it?
We aren't going to write your script for you, but we can guide you and help you with any specific problems you have along the way.
To start with, you need to figure out how to do each of the separate steps individually on the command line. Once you have the basic commands down, then you can worry about automating them in a script.
Finally, understand that most of us here work in bash, the default Linux shell, and aren't that familiar with ksh. A lot of the syntax and many of the features are the same, or very similar, and both support POSIX at least, but there may be ksh-specific things we don't know much about.