The word "ditto" comes from the Tuscan language where it meant "said," though today's modern definition is as an indication of anything repeated or a duplicate. When the English began to use the word, they used it like the Italians who originated it to avoid repeating the name of a month that had already been said.
As the English use of the word grew, so did the ways it was used. It grew to include the repetition of anything that was stated before, leading to the current use of the word. The word also developed into a form of agreement with another person. At one point, it also was used to refer to clothing that was all the same color, but that version fell out of use.