what is the difference between "to do" and "doing" in these s

he thought it absolutely senseless attempting the possible
he thought it sbsolutely senseless to attempt the possible

There is no difference in meaning in this case. The version with “to attempt” is slightly smoother in my opinion, but you may see both forms used.