The purpose of ethics, that is the study of morality, is something that we do not often discussed. Instead, we usually make moral arguments that are founded on the presupposition that everyone knows what a moral argument seeks to argue. That, I believe, is not useful, and I think it's important to start with a discussion on the nature of morality itself, as opposed to what is moral and immoral.
Ethics, being the study of morality, concerns itself with discovering the difference between right and wrong, between oughts and ought nots, between desirable and undesirable, between good and bad. It should not surprise you that all four of these dichotomies are in fact the same exact thing. We ought to do right because it is desirable and good, and we ought not do wrong because it is undesirable and bad. The syntax of that sentence can be arranged in many ways without changing the essential meaning. Why is something right? Because we ought to do it; because it is desirable; because it is good. Why ought we do something? Because it is right; because it is desirable to do so; because it is good. Why is something desirable? Because it is right; because we ought to do it; because it is good. Why is something good? Because it is right; because we ought to do it; because it is desirable. And so it goes. All these words mean the same thing, and it is hard to explain one without using the others. I can only assume that the thoughtful reader has a sense of what these words are referring to in fact.
This, to me, is a major hang up when discussing ethical questions. People choose different words to describe the same thing, and then end up in disagreement further down the road. Many Christians, for example, do not believe that what is right and wrong is the same as what is (intuitively) desirable and undesirable. But, what is really the case is that they believe certain things are more desirable than other things. They believe, for instance, that obedience to God is more desirable than the pleasure one would get from premarital sex. To them, obedience to God is either desirable in and of itself, desirable as a means to another desirable thing (i.e. heaven), or both. It's much the same for the hedonist that indulges every whim, only opposite. They might say that they think desire is more important than what's right, but what they are really saying is that they believe that base pleasure is more desirable than virtue, or that virtue isn't desirable at all. Now that we hopefully have this problem of semantics resolved, we can actually approach the purpose of ethics itself.
The purpose of ethics is to find an end or ends of reasonable action, or discover if such an end or ends exist. These ends must be right in and of themselves, good in and of themselves, desirable in and of themselves, and they ought to be pursued in and of themselves. If we say that something is good, right, desirable, or ought to be pursued, then it must either be a means to such an end, an end in itself, or both.