Christ was not quoting a passage from the Old Testament. He was referencing something that had been revealed to him previously about the Father's will–seen in John 6:39;
"And this is the Father’s will which hath sent me, that
of all which he hath given me I should lose nothing, but should
raise it up again at the last day." (John 6:39;)
Essentially, God tells Jesus that it is his will for Christ to save all of his children.
In John 18:8-9 Jesus Christ offered Himself to His enemies if they would let His disciples go free. This ensured the immediate physical safety of the Apostles, who would become the leaders of the Church following Jesus’s death. This small detail is a reflection of the larger event that was then taking place, a mirror of the Atonement of Christ. The Savior gave Himself so all of us could be set free from the eternal enemies of sin and death ("Of them which thou gavest me have I lost none.").
Christ is the good shepherd and we are his sheep, these scriptures communicate that he has made sure that not a single one of his flock will be lost.
Prophets have used similar phraseology to refer to the people they've been commanded to preach to:
"Behold, I and the children whom the Lord hath given me..." (Isaiah
8:18)
which is quoted in Hebrews:
"And again, I will put my trust in him. And again, Behold I and the
children which God hath given me." (Hebrews 2:13)