So to start to rephrase your question:
you have one entity, which includes a YEAR attribute
you want to show records, grouped by the YEAR attribute.
In this case, the easiest way to go would be to actually extract the YEAR attribute into a different entity (maybe bundle some other attributes in there as well and call that object over association. this way you only register the year once and all underlying objects will make use of the same information.
then you will be able to use a list view or template grid to show the YEAR objects and within that all the associated objects
Thank you, got it. However how to group those like..
>2021
>2022
>2023
. . . . like that. When I click on year it should expand and show the objects.
I would recommend you use OQL query to retrieve the data into a list