Should I talk about myself while writing a letter of recommendation for a student?
Only write about yourself if it clarifies why your opinion would be specifically relevant to judge the student. 

The reference is about the student, not yourself. Where more information about yourself is required to understand what you wish to say about the student, provide it. Otherwise, leave it out. The recipient will have to make up their mind as to whether you are (for them) a suitable referee or not.