Lastest logitech mouses like G403, G pro, G900 don't have a feature of assigning macro to LMB and RMB.
So basically, you have to assign no-recoil macro to mouse4, mouse 5 or etc.

It would be hard to aim while pressing these buttons.

So i made a copy&pasted LUA script by referencing to these two threads. 

-Recoil Macro for Logitech Gaming Mouse (from PUBG forum) (shift+2)asscold1 
-Logitech Macro's (from rainbow six forum) (shift+2)ironwsmroei


 
function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %d\n", event, arg)
if (event == "PROFILE_ACTIVATED") then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
ReleaseMouseButton(2) -- to prevent it from being stuck on
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then
recoil = not recoil
spot = not spot
end
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil) then
if recoil then
repeat

MoveMouseRelative(-2, 5)
Sleep(10)
MoveMouseRelative(2, -5)
Sleep(21)

until not IsMouseButtonPressed(1)
end
end
end
 
Just add this function to your profile.
Pressing Mouse button 4 will enable/disable no-recoil.