But he is not getting anything by creating us. If he is not getting anything then our creation is useless.

You are trying to view Allah as a being who has needs the way we do when Allah is free from needs and and can not be compared to His creation. If you give money for example to a poor person this does not give you any material benefit to you but rather it benefits the one you are helping. No one would say this is pointless or useless rather they would say that this is an honorable thing done by someone who doesn’t need anything from that person in return.