added utility function to remove duplications

added utility function to remove duplications in the
functions, errorOutput receives four input values
and format a string.