how does program counter stores the instruction memory when program is loaded?
Essentially all the text is saying is that somehow the program gets loaded into memory before the CPU can start running it.  Since the text only intends to discuss how the CPU executes instructions out of program memory, how the instructions end up in program memory in the first place is an implementation detail.  

There are many ways of getting the instructions into program memory, and it is highly dependent on the architecture.  

Systems based on read-only memory will have the instructions loaded into program memory either during manufacture of the chip itself (with a mask ROM) or with external programming hardware that writes to the memory array.  

Systems that contain flash memory often have some self-programming mechanism where the processor can either execute special instructions or write to special registers to trigger an erase or write operation on program memory.  The CPU may have to be stopped temporarily to allow the operation to complete.  

A standard desktop computer that executes out of RAM and loads programs off of a hard drive has a much more complex process.  In this case, the initial boot would be done out of a flash ROM of some sort, possibly copied into RAM by components on the motherboard before the main CPU is allowed to start running.  Then this startup code will load more code into RAM from a hard drive or solid state drive.  A desktop or server CPU actually doesn't even execute code out of RAM, it executes code out of on-chip cache memory, which is in turn loaded from RAM.  Because of this, it is possible that the CPU to run software out of cache while memory operations take place to do other things, including copying other executable code from a hard drive and into RAM.  The CPU also has stop and wait occasionally when the code it wants to run is not in the cache.