To hold your balance in handstand you need to be really straight with feet over hips over shoulders over hands and you need good body tension to achieve that. Try pushing yourself away from the wall but keeping the big toe of one foot against it to help you balance. The aim is to get as much of your weight as possible on your hands and reduce the pressure against the wall. You need your hands fairly close in to the wall but not right against it or you won't be able to move your body away from the wall without overbalancing backwards. It may also help you to do high bunny hops to learn to bring your hips over your hands. You might also want to try kicking up from a lunge so your back is against a wall. Take a big lunge and hold your body from your hands to you back leg straight as you kick up. Don't worry too much about bringing the other leg up to start, just bring it to 90 degrees and come back down to it again.
instead of walking your hands closer to the wall, turn around and kick up to do a hand stand against the wall and hold it. this will help your body and muscle get use to it. eventually it will be muscle memory and doing it without the wall won't be as hard. I use to do them against the wall all the time just for fun, once i started actual tumbling classes, handstands ended up being much easier for me than most.
Try and get more momentum, when you go into your handstand. Also strengthen your legs by doing drills, to make your kicks better! Or ask someone to lift your legs up when doing the handstand. Always remember to keep good form :)
Sounds like you are already doing the right thing but I guess as thats not working just throw yourself into it and really go for it !!! on soft mats maybe so it dont hurt to much !!! Thats how I learned :-D you could also get a friend the help hold your legs up !
getting the perfect handstand is quite hard. you need good abdominal muscles along with strong arms and legs :). the way i learned is by watching loads of tutorials and kept practising. its slow and it took me four and a bit months to master it but its defineately worth it :) sorry if this wasnt any help <3