aravinth there could be many reasons since i am not into coding i don't know how to troubleshoot that so what I recommend is to try testing using move extension, it could reorder all posts.
if something goes wrong you can soft delete all those 40 posts and re-create them in different discussion and move them to the buggy discussion.
but first, try moving back and forth that can fix.
before doing all these you can also try disabling all extensions + clear cache and check if any other extension is creating conflicts