"Ply" is a shorthand form of "apply." Gray shortens this word in order to fit the rhythm of his lines. "Elegy Written in a Country Churchyard" is composed in heroic quatrains of iambic pentameter. Using the word "apply" would throw off the rhythm of the poem.