Pigmentation can be of various types such as superficial and deep.
Also there can be multiple effects such as hormonal
imbalance, sun, certain medications can also cause it also it can be genetic.
It is good that you are using a sunscreen lotion, use a SPF of atleast 30, opt for non greasy preparation and apply atleast 15 min propr to stepping out in the Sun and re apply it after 3 hours.
If the topical creams are not giving significant result you need to meet a cosmetologist and discuss about chemical peels
such as glycolic and TCA
Also please get some investigations done which will facilitate in finding out the cause - your dermatologist
can guide you more on it