I want to get contents of the current line(the line with cursor) for my function. What command allows me to achieve this?
(buffer-substring (line-beginning-position) (line-end-position))
As Tobias noted, this also copies properties of text. If you want to avoid that, you might want to go with
(buffer-substring-no-properties (line-beginning-position) (line-end-position))