Why my Ruby method does not work the way i am expecting?

I have a Method (checkPos) which should check the Indexes of an array. When there is a specific Value in it it should not add anything !

The method works fine whenever i use it alone. like in this code :

while round < 9
  round += 1
  puts "You are in round #{round} of 9".colorize(:blue)
 checkPos($board, askPos())
end

But when i try to use it in the way i need it it will still add the given value even if the place is taken. like this :

while round < 9
round += 1
puts “You are in round #{round} of 9”.colorize(:blue)
player1Move(checkPos($board, askPos()))
outputBoard()
end


Am sorry i know what i added here is not clear enough . I did not add the code for the methods because they are too much and cant place them here !! PLEASE CONSIDER CHECKING THIS LINK which takes you directly to the file and there you can find all the codes
https://github.com/Korak-997/odinProject/blob/master/ticTacToe_new_test/configs.rb#L512

I would be more than happy to get any Suggestions or Solutions,
Thanks,