How to draw a line using Cairo

A simple line can be drawn using Cairo with the help of following code snippet.