ANSWER: First, let's take a look at the verses you mentioned:
"And He said to them, "When I sent you without money bag, knapsack, and sandals, did you lack anything?"
So they said, "Nothing."
Then He said to them, "But now, he who has a money bag, let him take it, and likewise a knapsack; and he who has no sword, let him sell his garment and buy one. For I say to you that this which is written must still be accomplished in Me: 'And He was numbered with the transgressors.' For the things concerning Me have an end."
So they said, "Lord, look, here are two swords."
And He said to them, "It is enough." " (Luke 22:35-38, NKJV)
It's difficult to imagine Jesus telling his disciples to buy swords, considering that he would soon state,
". . . for all those who take up the sword shall perish by the sword." (Matthew 26:52, NASB).
"'Put your sword back in its place,' Jesus said to him, 'for all who draw the sword will die by the sword.'" (Matthew 26:52, NIV)
Also, it was late in the day, and Jesus and his disciples would soon leave for the Mount of Olives. Jesus had much to discuss with them before he would be taken prisoner, so there would be no time to go to the market, argue for the best value for their garments, then haggle over the price of swords.
It's interesting that Strong's Concordance doesn't even acknowledge the noun sword in Luke 22:36. Bishop Pearce believes the word has been inserted from what is said in verse 38, as it is evident Jesus never intended any resistance to his capture, nor to allow such a weapon to be used on the occasion.
But in Luke 22:38 Strong's Concordance acknowledges the Greek word machaira, Strong's #G3162 , defining it as a knife, dirk or sword.
If we back up to verse 35 we hear Jesus reminding his disciples that he had sent them on a temporary journey with neither purse nor passports, nor shoes (see Matthew 10:5-10). When he asked if they lacked anything during the trip, they answered, "Nothing."
But when Jesus was no longer with them, their journey would not be temporary. They would need certain provisions, including a knife for preparation of food, cutting wood for fuel, and possibly to fend off robbers for which the area was noted. So, once Jesus' ordeal was over, they should make sure they each had a knife.
In Luke 22:38 the disciples said they had two knives, and Jesus said, "It is enough." By this he may have been saying that's all they would need, but Bible commentators Adam Clarke and John Gill believe he was saying, "We've talked about this enough." They are likely correct since, according to Luke's account, he then left for the Mount of Olives where his real agony would begin (Luke 22:39). Discussion about swords would be insignificant in comparison.