Rahul,
Have you reviewed the man pages for top?
$ man top
Depending on the version of top you're using, you might have -b and -n options.
My version of top...
$ top -v
top (procps version 2.0.7)
..has these options:
n Number of iterations. Update the display this number
of times and then exit.
b Batch mode. Useful for sending output from top to
other programs or to a file. In this mode, top will
not accept command line input. It runs until it pro-
duces the number of iterations requested with the n
option or until killed. Output is plain text suitable
for display on a dumb terminal.
By default top refreshes every 5 seconds, so if you have the above options, you might simply run:
$ top -b -n 720 > filename &
-Jared