The best way for a beginner to use the gym effectively

Hello, I am bibek From India. My dream is to build well-toned body shape and for that, I just join the gym At Starmark Fitness Studio. However, before I go there and doing stuff that is damaging my body. I want some suggestion for the best way to start my gym in terms of how long spend in cardio? Which diet do I need to follow and how effectively use a weight machine?

I am looking to get fitter and get a well-toned body, hope here I get my answer. Thanks in advance.