Not only that, the exercise clearly states that the 6% is an annual rate. That means one of two things: either the 6% is applied in intervals of 12 months or it is converted to a monthly interest rate that is not equal to 0.5% (but less -- compound interest and all that). There is a third possibility: the exercise composer overlooked these two things altogether and wants you to use the 0.5% nevertheless. You decide.
In your formula you don't mean f(n) = initial deposit (I hope?), but balance after n months.
In your formula I don't understand why you do not add Dm itself every month.
Why not build up a little table, jusdt to check the expression: f(0), f(1), f(2) etc.