For that you need to use line draw function,as the line is drawn pixel by pixel,you can give the points for that,here is how i did it for you.
UIGraphicsBeginImageContext(self.view.frame.size);
[testImage.image drawInRect:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 12.0, 0.0, 20.0, 14.0);
CGContextBeginPath(UIGraphicsGetCurrentContext());
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), 2, 5);
CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), 2, 5);
CGContextStrokePath(UIGraphicsGetCurrentContext());
testImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIGraphicsBeginImageContext(self.view.frame.size); //you can put here testimage to get the image only
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
This will also save the image in the phone's image library.
Hope this will help you.