How to write to a separate PHP file in plugin settings

It is impossible especially if you also need to keep the key in secret. Just use the DB.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)