can i use my hard drive from my all in one pc for my desktop pc
As long as the hard drive is in good shape, then of course you can. You should note, however, that it's probably going to be a slow hard drive - as long as you have an SSD boot drive and are only using the hard drive for data storage, you'll be good, but if you're using that hard drive as a boot drive, it'll be very slow.