Please help me to design n-back task, thank you

There are a few previous posts here:

For us to help you, we need some specific issues to deal with. Can you try implementing a schemings like the ones suggested, and then come back to us with specific questions (if still necessary)?