building text file with calendar dates

Can somebody help me in building a text file which will contain the dates of 2 yrs in the format YYYYMMDD using korn shell

e.g. to generate a file with the contents

20010101
20010102
...
...
20010131
20010201
...
...
20010228
20010301
...

and so on.

#! /usr/bin/ksh

#              ja fe ma ap ma ju ju ag se oc no de
set -A lasts 0 31 28 31 30 31 30 31 31 30 31 30 31

typeset -Z2 dmonth dday

#
#  loop on years

year=2001
while ((year<2003)) ; do

#
#  is this a leap year?
        leap=0
        if ((!(year%100))); then
                ((!(year%400))) && leap=1
        else
                ((!(year%4))) && leap=1
        fi

#
#  set number of days in february
        lasts[2]=28
        ((leap)) && lasts[2]=29
#
#  loop on month
        month=1
        while ((month<13)); do

#
#  loop on day
                day=1
                while((day<(lasts[month])+1)) ; do
                        dday=$day 
                        dmonth=$month
                        echo ${year}${dmonth}${dday}
                        ((day=day+1))
                done
                ((month=month+1))
        done

        ((year=year+1))
done
exit 0                               

Thanks Perderabo !

It has worked well.