Is it better to have no publication than having you as second author? I am a post graduate engineering student(Computer Science). I have only one conference (not very good) publication in my name as a first author. 
One of my seniors labmate, worked on a very good research project a few months ago and wrote a paper. I have been approached by him to generate a few more results for his paper and proof reading and extending his paper with literature survey and elaborative explaination of results. I have been offered co-authorship(2nd author) for this paper.
Now, though I can dedicate some time to do that work, but is accepting 2nd authorship worth. 

I would like to ask in general as well, that is it worth to put effort in papers and get 2nd authorship given that the paper is not related to my primary area of research or rather work and dedicate time on one's own research and get papers as a first author ?

Note: I have seen that in academia (where I want to go), usually advertisements call for applications from people having at least X no of papers as first author.
If the paper is well-written, contributes non-trivial knowledge to a particular field, is peer-reviewed, and you contributed significantly enough to the paper to be listed as an author, you should put your name on it. In the case of fields where pre-prints are common (i.e., it won't be peer-reviewed, at least initially), it is also worthwhile.

What you don't want is to be an author on a poorly written paper. In other words, you should be proud to list a publication on your CV even if it isn't exactly in your primary research area. Especially at this stage in the game, having a few good papers will help your case, even as a second author (and keep in mind that some fields, such as theoretical computer science, should have the authors listed alphabetically and all authors are considered primary).