Fitness data is not syncing correctly.

retrieving health/fitness data is somewhat complicated i would say since it also counts time zone in as factor so i would recommend you to look at other examples shared here on forum to know how it works if you want to build your own or use the widget that is shared whichever you prefer I would lay out some of the examples though I did use it back before 6 months ago and didn’t use after switching my phone to google pixel however I would say is retrieving correct data on Samsung devices might take some testing

or you could use tasker to fetch health data using the taskerhealthconnect plugin though i wouldn’t recommend it as it is more complicated than just simply add action and fetch data in tasker as it needs data request in Json format i believe because of of course Google so yeah, it’s not beginner friendly plugin as the dev of plugin put it.
RafhaanShah/TaskerHealthConnect: Android Health Connect Plugin for Tasker