AI-Driven Collaborative Resource Allocation for Task Execution in 6G Enabled Massive IoT