Hi, the memory on the Arduino MEGA is not big enough to create a loop pedal; you can create short delays or echoes, but unfortunately, a loop pedal requires a big amount of RAM and the Arduino boards have a limited amount.
Although there are many external flashes, eeproms etc. to attach the microcontroller via free pins to increase the memory to store samples or in this case loops, But there are plenty of single-chip record ICs which you can use. In both cases you need to midify PCB or better to make one.
You better to be a pro assembler or a qualified electronics expert to do this:
Gather ISD2560P or similar to loop up like a
Ditto Looper
If you are interested to figure out how it works, get ISD 1820 (Here's the schematic below) it's even compatible with Arduino and there are bunch of reviews and DIYs around the net. Check them out
With this tiny 14 pin chip you'll be able to
Record 2 seconds to 8~10 seconds
Play back can be either repeatable or edge-trigged, Level sense
4 available bandwiths
Super easy to circuit bend and hack (I added a pitch shift to it)