I am currently PhD student, and giving lectures to undergrad students (4 semesters). Is it legit to write about this activity in the CV separately. If yes, then how (i.e. lecturer)?
If lecturer is an actual title in your location, as it is in many, and you don't actually hold the title, then it would be a mistake to suggest otherwise. If you have full responsibility for a course then you could provide a list of "courses taught". But if you are just a guest lecturer in a course taught by another, you could provide a list of "presentations" with a bit of detail.
Don't say things that others might consider misleading.
You could also seek advice from your current department/school as to how to properly present yourself. Likewise, a professor that you worked for in such courses can provide some guidance.
In the United States, if you taught an entire course and did the grading, then you should use a phrase like
"Teaching Experience as Instructor of Record"
followed by a list of the courses. This would be under teaching experience. In some other countries this might not be understood.
If you are teaching as a part time job, I would suggest not listing that as employment, but this is a matter of personal preference.
You may need to adjust the way you write this depending on your audience.
When you write your experience section, use subheadings to split it into Research, Teaching, and Administration. This lecturing goes into the Teaching section.
I think it is legitimate to add this to your cv , but under the title: Additional academic work.