Hi Pavan,
The HTC M7's camera actually had a manufacturing defect IIRC that causes this issue. Usually you'll see this problem right out of the box when the phone is still under manufacturer warranty so they may still be willing to fix it.
If not you can check out a guide to replace the camera yourself [guide|31158|here.] Its pretty straight forward and most spares will not have this purple tint issue.