Notes:
Your spaghettis code is a bit difficult to follow, but I don't see where you are connecting to the broker. You need void reconnect() at the top of the loop.
Use MQTTExplorer to monitor the data being published.
The data to publish is a const char.
Here is a project of mine that publishes my freezer temperature on MQTT every ten seconds. It may give you some hints.