Modulate voltage output with a photoresists

Im currently trying to write a code with Ardudino one that can measure the value of a photoresistor and depending on that value it will adjust the voltage output to produce 3900 lumens with several LEDs.
I think i need to use the PWM function, but im still unable to understand how to combine the photoresistor and the voltage output.

I really hope you can help me; any suggestions are greatly welcome

This might work to give you an idea as to how it might be done. I didn't try to compile or test it; you'd need to adjust scaling to work with your setup:

const uint8_t pinLDR = A0;
const uint8_t pinLED = LED_BUILTIN;

void setup( void )
{
    //setup the LED output for testing (use the built-in LED)
    pinMode( pinLED, OUTPUT );
    //pinLDR will already be an input out of reset; this is a "human readability" formality
    pinMode( pinLDR, INPUT );
    
}//setup

void loop( void )
{
    int
        readingLDR;

    //read the LDR circuit input
    readingLDR = analogRead( pinLDR );

    //use the map() function to convert the 10-bit ADC reading (0-1023) to a value between 0-255
    //and write that value to the built-in LED as a PWM
    analogWrite( pinLED, (uint8_t)map( readingLDR, 0, 1023, 0, 255 );
    
}//loop