\documentclass[12pt]{article}
\usepackage{mailmerge}

\mailfields{name,id,class}
\begin{document}
% What you want as a preamble, and therefore not to repeat,
% will come here
\mailrepeat{% here's the part that will be repeated for each entry in your data base
	Name: \textbf{\field{name}}
	\hfill
	ID: \textbf{\field{id}}
	\bigskip
	
	Here comes your main text body...
	
	\vfill
	\hfill Class: \textbf{\field{class}}
	\clearpage
}% any text after this will be produced only one time, as a backmatter for ex.
%
% here comes your database entries
% it is a wise choise to collect them in another file, and \input the file when ever necessary
% and to use curly braces to group long paragraphed or punctuated textes
\mailentry{{Hasan Zakeri},123,A}
\mailentry{{Another one},456,A}
\end{document}
% that's all!