Retrireving data fro shared prefrences : I am saving some data in shared prefrences, but when i press back button and again go to profile, the data clears. What can i keep data stored with the help of shared pref

    package www.edukeen.in.eduaspire;
    public class Profile extends AppCompatActivity {
    EditText editTextName, editDOB, editphone, editcity, editclass, editboard, editschool, edithobbies, editachievements;
    Button buttonSave;

    public static final String MyPREFERENCES = "MyPrefs" ;
    public static final String Name = "nameKey";
    public static final String DOB = "DOBKey";
    public static final String Phone = "phoneKey";
    public static final String City = "cityKey";
    public static final String Class = "classKey";
    public static final String Board = "boardKey";
    public static final String School = "schoolKey";
    public static final String Hobbies = "hobbiesKey";
    public static final String Achievements = "achievementsKey";
    SharedPreferences sharedpreferences;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_profile);

        editTextName = (EditText) findViewById(R.id.editTextName);
        editDOB = (EditText) findViewById(R.id.editDOB);
        editphone = (EditText) findViewById(R.id.editphone);
        editcity = (EditText) findViewById(R.id.editcity);
        editclass = (EditText) findViewById(R.id.editclass);
        editboard = (EditText) findViewById(R.id.editboard);
        editschool = (EditText) findViewById(R.id.editschool);
        edithobbies = (EditText) findViewById(R.id.edithobbies);
        editachievements = (EditText) findViewById(R.id.editachievements);

        buttonSave=(Button)findViewById(R.id.buttonSave);
        sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);


        buttonSave.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String Name  = editTextName.getText().toString();
                String DOB  = editDOB.getText().toString();
                String Phone  = editphone.getText().toString();
                String City  = editcity.getText().toString();
                String Class  = editclass.getText().toString();
                String Board  = editboard.getText().toString();
                String School  = editschool.getText().toString();
                String Hobbies  = edithobbies.getText().toString();
                String Achievements  = editachievements.getText().toString();

                SharedPreferences.Editor editor = sharedpreferences.edit();

                editor.putString(Name, Name);
                editor.putString(DOB, DOB);
                editor.putString(Phone, Phone);
                editor.putString(City, City);
                editor.putString(Class, Class);
                editor.putString(Board, Board);
                editor.putString(School, School);
                editor.putString(Hobbies, Hobbies);
                editor.putString(Achievements, Achievements);

                editor.commit();
                Toast.makeText(Profile.this,"Data saved",Toast.LENGTH_LONG).show();
            }
        });
    }
}

Also if I want to get this data in my database what should I do, I have already signed in user, using firebase.