First define a new command at the beginning of your document as
\newcommand{\signature}[2][5cm]{
\begin{tabular}
{@{}p{#1}@{}}
\hrule \\[0.05cm]
\centering{#2}
\end{tabular}
}
Then use it at the end of the document for instance as
\flushright\noindent \signature{Firstname Lastname}