i have notice when I am practising with a partner I play very confident and accurate shots but when I am playing a game suddenly I go in a defensive mode and no confidence at all. How can I improve on the mindset as I start pushing the ball instead of attackingz
Yes this is a common problem that many players have. When you play in training firstly try to do more irregular and serve and return drills to make it more like match play situations. I would then say in games try to play positively by focusing on your strengths and trying to open up the first push back from your opponent, even if you make some mistakes in the beginning this will help you improve much more.
Also when you serve you can immediately be ready for an attack, try to have in your mind your first choice is always to topspin and if the ball is too short you still have time to step in and play a push.