Few days back I communicated a paper in a journal and some silly mistakes are there. While citing some other author's paper in my paper, instead of reference number it is showing a sign of question mark. I know that's a mistake while running the LaTeX code. I didn't check in hurry. Shall I inform the editor about my mistake? If yes, then how should I write a letter to convey this?
Yes, you should inform the editor. Simply resend the corrected paper, and explain the error. There is no need to write an extensive letter or to make a grand apology. Something like this in an email will do fine:
I am sending you a corrected copy of the paper titled '...', submitted on XX. There were errors on pages A, B, and C in the citations. They appeared as "?" instead of the correct citation, due to incorrect processing in LaTex. This version has the correct citation and I have proof read it for other errors.
Also - give the file a different name than the original and a different time stamp so there is no confusion between the corrected version and the original.
In mathematics (and I suspect in many other areas), the paper review process usually goes like this:
As you can see, there are several opportunities in the process when you can fix small typographical problems in the paper. And I have found typographical issues in almost every paper I have refereed, so it is expected that you will need to fix some.
One "trick" is not to put the paper into the style required by the journal (e.g. the journal's special LaTeX style) until the final revision. This guarantees that you have at least one shot to fix any typos, even if the referee miraculously does not recommend any changes.
Note that significant changes are something else entirely, and you should avoid them if possible once the paper is submitted. This includes things like rewriting the proof of a theorem or adding new results. But fixing a misspelled word or replacing a "??" with a citation number are fine.