You must follow in your admin, Store -> Configuration -> Catalog -> Catalog -> Search Engine Optimization -> Use Categories Path for Product URLs, you must change to No, and you have to make sure that in the Website and Store View is No.
After that, you must reindex and refresh the cache.
in order to get rid of the object manager you need to move all classes that are needed to the construct method using dependency injection.
Please have a look and try this modified code
class CatLogic extends \Magento\Framework\View\Element\Template implements \Magento\Framework\View\Element\Block\...
First change the current state for the Anchor.
eg - If the Anchor is turned off for this category, turn it on and save the category.
Then change the product positions and save.
After confirming your products are correctly positioned. You can revert the Anchor back to its original state.
It could be that the content that you are trying to edit is stored in a CMS block.
In the category's Display Settings, see if Display Mode is set to "Static block only" or "Static block and products".
If so, the static block is set in the category's Content section under Add CMS Block.