Hi @Sathiya Saravanan,
Thank you for posting in this community.Based on the description of your question, I don't think it's necessary for us to use code to show the total number of items in each status. Grouping by status is sufficient.
You can configure it according to part "Grouping documents or items in a view" in this article (Use grouping to modify a list or library view).
You can see that the number in parentheses after each grouping is the total number of items in that status.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.