Limited recreation of a button through a forloop

Hi.

So I’m building this app where each time the floatActionButton is clicked, a button is created. That aspect of the app works fine. But my problem is that the buttons are being created on top of one another and are constantly created. I need to create only 4 buttons click after click, one below another.

This is my for-loop. I appreciate any help.

addingSemester.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                for (int i = 0; i <= 4; i++){
                    Button semesterButton = new Button(MainActivity.this);
                    semesterButton.setId(i);
                    semesterButton.setText("Semester " + i);
                    semesterButton.setLayoutParams(lp);
                    semesterLayout.addView(semesterButton);
                    i++;
                }
            }
        });