Unable to make custom Bitcoin command
To add a new RPC, you need to write the function the implements it's action, add the function to the dispatch table, and update bitcoin-cli's type conversion table.

At the bottom of the RPC file you added your function to (in this case, src/rpc/blockchain.cpp, you will see a table that has all of the RPCs in that file as well as some extra information about them like category, name, and argument names. Add your new RPC to that table.

Next, if your command has any arguments which are not strings, open src/rpc/client.cpp and add those arguments to the vRPCConvertParams list there. In that list, you give it the RPC name, the index of the argument that needs to be converted, and the name of that argument.