I get that tension in a mass-less string arises because of electrostatic forces which arise because atoms of the string are pulled apart. I also understand that it is equal and opposite in direction at all points because otherwise the string would accelerate infinitely. But what about the last point in the string which is in contact with the block? It has a tension T upwards, but what does it arise because of? Similarly, the topmost point in the string has T downwards. What does it arise because of? And why does it have to be T in both the cases? Can't it be different? If not, why?