Instead of using a macro, consider using a function. The function indent-region
contains arguments for the beginning and ending of the region. Thus, you could evaluate (indent-region (point-min) (point-max))
to handle the entire buffer. You could also use a simple function to do the same thing:
(defun my-format-document () (interactive) (indent-region (point-min) (point-max)) )
Although not needed here, in the future you may need to use something like save-excursion
which brings you back to the original point.