What have you tried so far? Your question is very broad. The following should get you started:
property secondsIn120Days : 10368000
tell application "Mail"
set theInbox to inbox
set dateToday to current date
set firstMessage to 1
set lastMessage to (get count of messages in theInbox)
repeat with thisMessage from lastMessage to firstMessage by -1
set currentMessage to message thisMessage of theInbox
set messageDate to date received of currentMessage
set timeDifference to dateToday - messageDate
if timeDifference ≥ secondsIn120Days then
(* In answer to your comment, any folder you create to archive
messages is going to be in the "On My Mac" directory. But say you
create a Smart Mailbox called "Mail Archive" then all you should
need are these lines... *)
set archiveMailbox to (mailbox ("Mail Archive" as string))
move currentMessage to archiveMailbox
end if
end repeat
end tell
UPDATE: Added response to comments in the code.