Here's the link to his letter. It was written in two parts. The first part is written before the battle. The second is after he was wounded in the hip and wrist during the fighting at the Dunker Church on the north side of the battlefield. He wrote this after being shot:
Dearest Mother -
I am wounded so as to be helpless. Good by, if so it must be. I think I die in victory. God defend our country. I trust in God, and love you all to the last. Dearest love to father and all my dear brothers. Our troops have left the part of the field where I lay.
Mother, yours,
Wilder
All is well with those that have faith.
https://www.masshist.org/database/2169