The purpose of a poem is to express a theme or create a mood. In Shelley's "Ozymandias," the theme becomes clear with the last lines:
"My name is Ozymandias, king of kings:
Look on my works, ye Mighty an despair!"
Nothing beside remains. Round the deay
Of that colossal wreck, boundless and bare
The lone and level sands stretch far away.
Ozymandias is probably a reference to the Egyptian pharaoh Ramses II, who built impressive statues, pyramids, and kingdoms. His proud boast, which is written on the ruins of a statue of him, is a vain and an empty one because nothing remains of his works. With the exception of these broken ruins, all has disappeared into the sand. Shelley shows us man's attempt to immortalize himself through his works. But he shows that such attempts are futile. Time and nature ("sand" symbolizing both) will eventually overcome all our works, no matter how great and impressive the works once were.
Correlated with Ozymandias's attempts to make a permanent mark are the sculptor's attempts as well.
. . .its sculptor well those passions read
Which yet survive, stamped on these lifeless things,
The hand that mocked them, and the heart that fed . . .
The sculptor also showed skill in his works, but little of that skill remains--a "shattered visage," "trunkless legs," and "a pedestal." Just as a king's works do not remain, an artist's works are temporary. Both the hand of the sculptor who fashioned the original sculpture and the heart of the pharaoh which inspired it are no more. Men and their works are mortal.
Shelley's purpose is to remind us of this cold hard fact, and perhaps instill humility in the minds of his readers.
The link below contains a thorough discussion of the poem, its themes and techniques.