My friend wants an old assignment which I have done few semesters ago. I want to know whether it's ok to give the assignment to him and whether it's going to be a problem for me in the future. (I have already done that subject, but still following the degree) Please let me know.
There is no single right answer here. The answer depends from university to university, and even from faculty member to faculty member. For example, one professor in my department believes everything should be sharable, while another believes that it's wrong to share old materials.
So you'll need to see what the policy of the instructor teaching your friend's class is.