The suffix -gram is derived from ancient Greek: (gramma), meaning something written, i.e. telegram means something written at a distance and cablegram means something written via a cable, whereas telegraph implies the process of writing at a distance.
The word "telegram" comes from the Greek words "tele," meaning "distant," and "gramma," meaning "letter." It refers to a communication sent over a distance, usually via a telegraph system.