The whole Israelite community set out from the Desert of Sin, traveling from place to place as the Lord commanded. They camped at Rephidim, but there was no water for the people to drink. 2 So they quarreled with Moses and said, “Give us water to drink.”"Put the Lord to the test" is translated as "tempt the Lord" in the KJV. In any case the thrust of this story is that God is ultimately persuaded to provide water because of the people's discontent. The idea that God can be tempted (or tested) comes up several times later in both the Tanakh and the Gospels. (As always, the place names in this story are not real.)
Moses replied, “Why do you quarrel with me? Why do you put the Lord to the test?”
3 But the people were thirsty for water there, and they grumbled against Moses. They said, “Why did you bring us up out of Egypt to make us and our children and livestock die of thirst?”
4 Then Moses cried out to the Lord, “What am I to do with these people? They are almost ready to stone me.”Again, God needs Moses to use a prop in order to produce the magic. He couldn't just direct them to a spring, or make the water flow himself. There is actually a different version of this story. It is retold in Numbers 20, but there Moses is ordered to "speak to the rock," although he does ultimately also strike it with his stick. There is what appears to be a reference to this event in Deuteronomy 33, although it is somewhat obscure.
5 The Lord answered Moses, “Go out in front of the people. Take with you some of the elders of Israel and take in your hand the staff with which you struck the Nile, and go. 6 I will stand there before you by the rock at Horeb. Strike the rock, and water will come out of it for the people to drink.” So Moses did this in the sight of the elders of Israel. 7 And he called the place Massah[a] and Meribah[b] because the Israelites quarreled and because they tested the Lord saying, “Is the Lord among us or not?”
8 The Amalekites came and attacked the Israelites at Rephidim. 9 Moses said to Joshua, “Choose some of our men and go out to fight the Amalekites. Tomorrow I will stand on top of the hill with the staff of God in my hands.”Okay. This is already weird. Amalek, as I'm sure you don't remember, was a grandson of Esau, so these people are cousins. However, God chose Jacob so too bad. The Amalekites appear again a few times, as inhabitants of the Negev in what is today Israel. So what the heck are they doing in this wasteland in Sinai where there is no food and no water unless you happen to be the beneficiary of a God who keeps you alive through miracles? And why the heck do they attack the Israelites?
10 So Joshua fought the Amalekites as Moses had ordered, and Moses, Aaron and Hur went to the top of the hill. 11 As long as Moses held up his hands, the Israelites were winning, but whenever he lowered his hands, the Amalekites were winning. 12 When Moses’ hands grew tired, they took a stone and put it under him and he sat on it. Aaron and Hur held his hands up—one on one side, one on the other—so that his hands remained steady till sunset. 13 So Joshua overcame the Amalekite army with the sword.Until a few weeks ago, the Israelites were slaves, remember? They would not have been allowed to possess weapons, and according to the events of this tale there is no conceivable way they could have gotten any. Even if they did have weapons, they have had no occasion to use them for 400 years and would have no idea how to fight a battle. Fortunately, despite these disadvantages, they can win by means of some remote control magic. As long as Moses keeps his arms raised, they win! It doesn't matter whether he's holding them up on his own -- he is physically unable to do that for long enough to complete the victory, so his brothers hold his hands up. You will have to decide for yourselves what the point of this may be.
14 Then the Lord said to Moses, “Write this on a scroll as something to be remembered and make sure that Joshua hears it, because I will completely blot out the name of Amalek from under heaven.”Well, no. We will meet them again several times, their name will be quite familiar actually.
15 Moses built an altar and called it The Lord is my Banner. 16 He said, “Because hands were lifted up against[c] the throne of the Lord,[d] the Lord will be at war against the Amalekites from generation to generation.”One suspects that this passage was interpolated here to justify the later hostility toward the Amalekites. Remember that all this was written some 2,000 years after these events supposedly happened. That it makes no sense whatsoever is apparently not a concern.