how to convert an integer to binary in Arduino?

You're creating an int of that value, not a string (or char array).

unsigned long converted;

Start by changing that to

char converted[4];

and add quote marks around the digits. Change the rest of your code accordingly.

By the way, instead of

    converted = 0010;
    return converted;

you can completely remove the converted variable, it's not used anyway, and change this to

    return "0010";