If you make a single-day trip you may not enjoy your tour to the fullest. You must leave very early and return to Cusco at night.
Although you will be able to climb Huayna Picchu in the morning and do Circuit 1 in the afternoon, you will miss the opportunity to get to know the town of Aguas Calientes a bit, which has to offer, for example, the hot springs.
The best alternative would be to go from Cusco to Machu Picchu Pueblo in the morning, explore the surroundings, go to the hot springs, and sleep there. The next day, get up early to see Machu Picchu and return in the afternoon.
It all depends on the time of year. Keep in mind that the high season is from May to October (dry months) and the low season is from November to April (rainy months).
If you want to go to Machu Picchu, for example, in July and August, the most popular months, you will have to buy your tickets at least two months in advance.
If you go in the less touristy months, such as February or March, you can even buy from one day to the next.
The direct train from the outskirts of Cusco (Poroy station, service available from May to December) takes approximately 3 hours and a half to Machu Picchu Pueblo.
If you take the train at the Ollantaytambo station (two hours by road from Cusco), it will take you an hour and a half to get to Aguas Calientes.