Used to convey what somebody has said
We already know that Xと言いました can be mean “[somebody] said X”
However, looking more deeply, just as with 行こうと思う (I’m thinking of going) and 彼は行こうと思っている (He’s thinking of going), 言う more often refers to what the first person is saying, and 言っている to what the second and third persons are saying.
So we get
明日行けないと行ったよ。
I told you I can’t go tomorrow.
But for the third person:
黒田さんは「明日休みます」と言っていました。
Mr Kuroda said “I’ll take the day off tomorrow.”
this can be used with the plain form to convey the message as indirect speech, in a similar way to “they said that ……” in English.
明日休むと言っていました。
he said he’d take the day off tomorrow.
んん、そう言っていましたよ。
Yes, that’s what he was saying.
Have a look at this explanation from japaneseammo.com.