why is particle system duration read only?

Is there any way i can it via script?

No there is not. You would have to re-create the entire particle system.

Actually there is a way and it is in the documentation:

public class ExampleClass : MonoBehaviour
{
    private ParticleSystem ps;

    void Start()
    {
        ps = GetComponent<ParticleSystem>();
        ps.Stop(); // Cannot set duration whilst particle system is playing
        var main = ps.main;
        main.duration = 10.0f;
        ps.Play();
    }
}

You can use the main object attached to the particle systems.