Economics is a science and hence the objective of economics is the same as of any science just applied to the specific discipline. Thus this objective depends on how you want to define what an objective of science is and on the demarcation of what economics is.
On the objective of science:
There are many different approaches to the philosophy of science and some of them differ in their view of what the objective of science is. Unfortunately, SE format is not suited to broad answers so it is beyond the scope of this answer to provide an overview of all possible philosophical views on what the objective/purpose of science is (although I encourage you to have a look at some textbook on the philosophy of science such as Rosenberg, Philosophy of Science: A Contemporary Introduction; Okasha Philosophy of Science etc.) but it is generally agreed by the philosophers of science that the main purpose of science is to explain or understand and predict various phenomena (see Purtill 1970).
Under this predominant view, in the same way, as it is the objective of physics to explain gravity, not to use it to improve people's lives, it is also objective of economics to explain various economic phenomena (trade patterns let's say) not necessary to help anyone by explaining them (however, people are not just scientists they are also moral beings, and as such many scientists might be motivated by helping others, but these are personal goals not goals of the science itself, and also as mentioned above there might be philosophers of science that would disagree with this view - but this view is quite general).
Demarcation of economics:
Currently the mainstream definition of what economics is the one that was provided by Robbins (1935),
the science which studies human behaviour as a relationship between ends and scarce means which have alternative uses.
Again, this is not the only possible way of defining the field of economics but it is the mainstream one that you would find in almost any undergraduate general economics textbook (for further discussion on this issue consult some philosophy of economics textbooks such as Ross, Philosophy of Economics or Hausman The Philosophy of Economics: An Anthology).
Consequently combining the mainstream view of what science and economics is the goal of economics is to explain/understand and predict economic phenomena. Where economic phenomena should be understood as phenomena pertaining to human behavior in situation when humans have some ends and scarce means with alternative uses to pursue those ends.
Hence, in reference to the topics you mentioned above, the goal of economics would not be to
define laws so that basic human needs are fulfilled and people do not die of hunger due to lack of money
but to study how people fulfill their needs, what choices they make, how they can best optimize their resources in various situations - but it is not the role of economics to define laws that ensure human needs are satisfied. 'Law' in economics does not even have necessarily the same meaning as in common speech, rather in economics we try to formulate scientific laws. You can use the knowledge of economics to produce famine as well as to help reduce impact of one.
Similarly, it is not the role/purpose of economics to:
Find out laws so that inequality does not increase only
but rather to study what drives inequality, how different policies can affect inequality etc. and then it is up to policymakers to decide if inequality is a problem and how to solve it.