I got an invitation to review a scientific paper from a journal. I accepted the offer to review but was wondering what benefits I might get if I review a paper? Can I write it in my CV as I will be applying for a Ph.D. position soon? Someone told me if I write it in my CV that I reviewed an article, no professor is gonna hire me thinking she already knows so many things and it will be hard to control her during the whole Ph.D.! Still, I accepted the offer out of excitement. Also, if my review is not up to the mark, is it like the editors will never give me anything to review again?
As mentioned in the other answer, reviewing is an important service to the community.
However, you will also profit yourself from reviewing: You will learn about a new topic. You will learn about how a review process works. You get to see the other side, which will most likely helpful for your own future paper writing: Since you know how reviewing a paper feels from the perspective of the reviewer, you can better understand how to make a paper accessible to reviewers and readers, and how to best respond to reviewer comments.
And, in addition to these benefits, you can indeed list in your CV that you review for journal X, Y, and Z - this does not only show that you are willing to help the community (which will recflect positively on an application), but it also shows that the editors of the journal consider you competent to review their papers.
It's also good because it allows you to develop reputation and rapport with the editors, who are usually "high up" in your research community. There's a good chance they have some influence over conferences, funding, etc. And of course if you submit a paper to their journal, they will be more likely to take you seriously if they know you've carefully reviewed other recent research there.
In addition to the other answers: Being a referee might also help in obtaining a visa.
Some countries offer visas for people with special abilities (in the US e.g. the O-1 visa). This includes scientists.
Getting a letter of recommendation from a journal editor where one has performed a few reviews might be of great help in proving this specialist status. In fact this is listed as one criteria for the O-1 visa.
Also it probably does not harm to deliver good reviews.