Hexokinase enzyme is present in all cells (including muscle cells) and can be suppressed by excessive G-6-P product. So that's why in the liver, glucokinase can act on glucose without inhibition of it despite excessive G-6-P product; that's why it can generate glycogen and not let excessive glucose flow back in bloodstream. My question is then: why muscle cells can generate glycogen despite having HK instead of GK? Because as i said above, HK activity is dependent on intracellular glucose level, and cannot phosphorylate glucose to hold it inside the cell. So glucose enters back to bloodstream and prevents the synthesis of glycogen?
The answer to the question is that under conditions favouring glycogen synthesis (e.g. the fed state) G6P only accumulates in skeletal muscle cells when the capacity of those cells for storing glycogen has been reached. Until then the G6P is immediately converted to G1P and on to glycogen, in the reactions in sunboyharry's answer.
The question suggests a misunderstanding of the role of glucokinase in liver, which can be better considered if we first make clear the role of liver and skeletal muscle in glucose metabolism. The role of the liver is to deal with excess glucose after a meal by trapping it in the cell as G6P. Although initially the G6P may be converted to G1P and hence to glycogen, this is not the only fate of G6P. Subsequently it may be directed to glycolysis and to the pentose phosphate shunt to provide the acetyl units and reducing power (NADPH) needed for fatty acid synthesis. (The fatty acids are converted to triglycerides and exported to the adipose tissue.) When the blood glucose falls the role of the liver is to release glucose into the blood to supply those tissues that depend on it (brain and erythrocytes in starvation, skeletal muscle if the fall is due to muscle exercise). The skeletal muscle, in contrast, is only concerned with storing glucose as glycogen when it is available, and converting it to G6P for glycolysis when it needs ATP to power muscle contraction.
Glucokinase has a key role in the regulation of blood glucose concentration by the liver. To paraphrase (and edit slightly) Cornish-Bowden and Cardenas: "Mammals have two types of enzymes to catalyse the formation of G6P from glucose. Glucokinase [hexokinase D in their nomenclature] differs significantly from the other type [generally just referred to as hexokinase]. Its abundance varies markedly with hormonal status; it requires much higher glucose concentrations (about 10 mM) for half saturation, and is insensitive to physiological concentrations of G6P. It is thus well adapted to respond to variations in blood-glucose concentrations."
To clarify, 10mM is in the region of the blood glucose concentration (ca. 5mM) so the glucokinase reaction will be affected by the relative concentrations of blood glucose and intracellular G6P in a standard mass action manner, which will determine whether the liver takes up glucose or releases it into the blood. If glucokinase were inhibited allosterically by G6P like hexokinase, this couldn't work.
Now let's turn to G6P and hexokinase in skeletal muscle. Hexokinase has a much higher affinity for glucose than hexokinase and will convert it efficiently to G6P. As long as G6P is then converted to G1P for glycogen synthesis, G6P will not build up. However when glycogen synthesis stops because the capacity of the muscle to store glycogen is reached, the concentration of G6P will increase and turn hexokinase off. This, in turn, will cause a build up of intracellular glucose and prevent glucose transport into the muscle. This makes sense, because with full glycogen stores, and in the absence of need for contraction, glucose will not be metabolized by the muscle; it will be left in the blood for the liver to handle.
Thus, the key point about G6P inhibition of hexokinase, and the apparent source of confusion in the question, is that it only occurs at concentrations that are reached when the G6P is not being metabolized within the cell.
Reference and Footnote
Ref for citation: Cornish-Bowden, A and Cardenas, M.. (1991) Trends in Biochemical Sciences 16, pp281-2. (This article also makes the point that the kinetics of glucokinase are sigmoidal and not hyperbolic as stated in most texts, and that the enzyme is not specific for glucose. Neither of these points affect the argument here. The former does indicate that my reference to glucose control of glucokinase operating in "a standard mass action manner" is a simplification. It does respond to changes in glucose concentration in the blood range, but in a more sophisticated manner than an enzyme with simple Michaelis-Menten kinetics.)
Hexokinase catalyze glucose to form G-6-P is only the first step of the glycogen synthesis, and then the G-6-P will continue to processing a series reaction and finally become glycogen. So once the G-6-P forms, it will keep reacting, which will not inhibit the activity of hexokinase.