Birds such as parrots are social creatures. They inhabit flocks and regularly communicate with one another. The attention that each one gives and gets is essential to its well-being.
When a bird comes into your house, it thinks it has come into a flock of non-winged, non-flying, oddly shaped birds. It still wants to communicate with its flock. It wants to give as well as get attention. These animals learn sounds by mimicry. Even non-speaking birds such as songbirds learn to sing by imitating the adult birds. A few sounds are innate – the feathered creatures are born with the knowledge to make these sounds, but complex sounds are learned by hearing other birds.
Parrots and other speaking birds can mimic the complex sounds of human speech. It may take them a while, but your feathered pet will soon repeat what they hear. If it is essential to you that your bird learn to speak, then adopt an adult which already speaks. It will readily pick up new words.
Until a birds speaks, it will squawk and otherwise make a racket. It wants you to communicate with it, and it wants attention. If you yell at a squaking bird, it will be counter productive, because you will be giving it the attention that it craves.
Birds require care and understanding. They are needy, in that they need attention from their human companions to thrive.
You can teach your bird to talk by speaking to it regularly. Use a recorded message that plays over and over. Or hide behind a mirror so that the bird sees its reflection and thinks that it is talking to another bird.