Hi! You are right, example if you want predict next token in sequence, you have to do like this
Input: [1, 2, 3, 4, 5]
Output: [2, 3, 4, 5, 6]
Attention mechanism more effective at predicting sequences based on certain rules compared to older models ex. for usage language models, protein sequences.
If you want understand transformers and attention mechanism, you can look GPT source code, its not very complex and its understandable.