The correct syntax is the following for a multiple if/then/else with multiple ands:

if (and(Sex == 'male', and(Age > 30, Pclass == 3)), 'GroupMaleOldRich',

if (and(Sex == 'male', and(Age <= 30, Pclass == 3)), 'GroupMaleYoungRich',

if (and(Sex == 'male', and(Age > 30, Pclass <= 2)), 'GroupMaleOldPoor',

if (and(Sex == 'male', and(Age <= 30, Pclass <= 2)), 'GroupMaleYoungPoor',

'GroupOther'))))

So in your case, that would give:

if(and(prof=='X',and(target=='true',and(active=='true', and(click==1, download==1)))), 'GroupA',

if(and(prof=='X',and(target=='false',and(active=='true', and(click==1, download==1)))), 'GroupB',

'GroupOther'))