The best way is to swing your hands briskly and keeping your posture upright while walking. Listening to music is good while walking as it has a soothing effect on our mind and body.
Just like people listening to motivational songs and music in the gym, we listen to peaceful music and even sometimes slow songs to feel relaxed while walking, it negates the feeling of loneliness when we walk alone.