This is almost word for word in Matthew, chapter 26:27, and similar in Luke, chapter 22:17, but there it preceded the blessing of the bread. Paul used almost the same wording in I Corinthians, chapter 11:25. John, chapter 6:53-58, had Jesus preaching about eating and drinking the body and blood of the Son of Man. Matthew and Mark agree that Jesus took a drinking cup (καὶ λαβὼν ποτήριον), assuming this cup was filled with wine. After giving thanks or eucharistizing it (εὐχαριστήσας), Jesus gave them this drinking cup (ἔδωκεν αὐτοῖς). Instead of telling them to drink from this cup, as in Matthew, Mark simply said that all of them drank from it (καὶ ἔπιον ἐξ αὐτοῦ πάντες). This new developing Christian Eucharistic worship service used the Greek word “εὐχαριστήσας (giving thanks)” as it became the name of the Last Supper remembrance event.
Matthew, chapter 15:36, has a similar statement about the thanksgiving, blessing, and the distribution of the 7 loaves of bread and fish. Mark said that Jesus ordered or directed the crowd to sit down or recline on the ground (καὶ παραγγέλλει τῷ ὄχλῳ ἀναπεσεῖν ἐπὶ τῆς γῆς), instead of earlier on the grass. This was going to be like a large picnic. Jesus took the seven loaves (καὶ λαβὼν τοὺς ἑπτὰ ἄρτους). There is no mention of the fish here. He gave thanks or eucharized them (εὐχαριστήσας) and then broke them apart (ἔκλασεν). He gave them to his disciples to distribute (καὶ ἐδίδου τοῖς μαθηταῖς αὐτοῦ ἵνα παρατιθῶσιν). Then the disciples gave or set them up before the crowd (καὶ παρέθηκαν τῷ ὄχλῳ). This feeding of a large group of people harkens back to the Exodus story, chapter 16:1-36, about the manna and the quails in the wilderness, but on a smaller scale. Yet the word “thanksgiving” was used here instead of a “blessing” as at the earlier feeding of the 5,000 people in chapter 6:30-44. This has almost a foretaste of the Eucharistic Last Supper of Jesus, when he gave thanks, blessed and broke the bread. Otherwise, this process is very similar to the first multiplication of the loaves of bread. However, Jesus did not look up to heaven here. Jesus gave the food to his disciples, who in turn gave the food to the people in the crowd.
This is almost word for word in Mark, chapter 14:23-24, and similar in Luke, chapter 22:17, but preceding the blessing of the bread. John, chapter 13:53-58, has Jesus preaching about eating and drinking the body and blood of the Son of Man. Matthew and Mark agree that Jesus took a drinking cup (καὶ λαβὼν ποτήριον), assuming this cup was filled with wine. After giving thanks (καὶ εὐχαριστήσας), Jesus gave them this drinking cup (ἔδωκεν αὐτοῖς). He told all of them to drink from this cup (λέγων Πίετε ἐξ αὐτοῦ πάντες). He said that this was his blood of the covenant (τοῦτο γάρ ἐστιν τὸ αἷμά μου τῆς διαθήκης), that was to be poured out for many people (τὸ περὶ πολλῶν ἐκχυννόμενον) in order to forgive sins (εἰς ἄφεσιν ἁμαρτιῶν). The blessing of the wine had a more elaborate narrative than the bread. However, both would become part of the new developing Christian Eucharistic worship service. Thus, the Greek word “εὐχαριστήσας (giving thanks)” became the name of the Last Supper Eucharist remembrance event.
This psalm ends with where it began, by giving thanks to Yahweh. The psalmist gave thanks to Yahweh because he was his God. He extolled him and gave thanks because Yahweh was good as his steadfast love endures forever.