well,on the a and h file all the king has to do {the one with no pawns }is to go into the corner {on the one the pawn is going to promote on}then that'll be stalemate,but in any other files the king with pawn wins only if it has the opposition
Forcing stalemate in K+P endgames.

Yes, if you are defending against a pawn you can draw against a rook pawn by getting your king in the corner. (Pawns on the 'a' and 'h' files are typically called rook pawns.)
Depending on the position, it's also possible to draw against pawns on other files by defending against the queening square.

in every other file {except rookfiles}the king with the pawn must be in front of the pawn having the opposition like Loomis's diagram

I would say that is correct. It would end in a draw like in the loomis diagram. It would be a won game for white though if the king is in front of the pawn.

Thanks for your replies.
So, if you are the side that has the only remaining pawn, and that pawn is on any file b-g, how can you ensure a win? Is it by your king obtaining "opposition," or by preventing your opponent's king from obtaining it? And how is this accomplished?
I think I just figured out something about endgames in which only both kings and one pawn are left on the board, and wanted to find out if I am correct or not. If the remaining pawn is on the "a" or "h" files the side with no pawns left can force stalemate, but if it is on any other file, and he is not able to capture it, he can't force stalemate, and will lose. True?
For the most part this is true, but, as with many rules, there are the exceptions.

Thanks for your replies.
So, if you are the side that has the only remaining pawn, and that pawn is on any file b-g, how can you ensure a win? Is it by your king obtaining "opposition," or by preventing your opponent's king from obtaining it? And how is this accomplished?
I'd recommend an endgame book for a thorough treatment, but basically you want to keep your king in front of your pawn. If you can reach the following position, you win regardless of the move:
White wins with the move by Kd6 Kd8 e6 Ke8 e7 Kf7 Kd7. White wins on Black's move by ...Kd8 Kf7 Kd7 e6+ etc.
Conversely, this position is drawn regardless of the move:
Kd6 Kd8 e7+ Ke8 Ke6 stalemate. If White tries to buy time with, say, Kd5, then Ke7! forces a return to the initial position after Ke5 Ke8.
Black to move, following the same idea, draws by Ke7 Kd5 Ke8! Kd6 Kd8 etc.
Understanding these positions is critical to a basic understanding of king-and-pawn endgame play. Well worth the time to learn.
If you need help, please contact our Help and Support team.
I think I just figured out something about endgames in which only both kings and one pawn are left on the board, and wanted to find out if I am correct or not. If the remaining pawn is on the "a" or "h" files the side with no pawns left can force stalemate, but if it is on any other file, and he is not able to capture it, he can't force stalemate, and will lose. True?