check if value of column in table 1 exist in table two, if yes add 1 to that value and check again

I have two table

table 1

file number

110

111

123

table 2

file number

124

125

167

111

first I want to check in table 1 the largest value then add 1 to that value.

after that I want to check the newvalue in table 1 exist in table2 if yes again add 1 to it and re-compare(repeat this process untill we unique value)