You might be able to but you really shouldn't. At the best you wouldn't have control over fan speed. Find the wiring diagram for the board and use a fan header
Per https://help.prusa3d.com/article/xbuddy-and-loveboard-electronics-wiring-mk4_413095 it looks like you dont have any fan headers, you might be able to repurpose the unused ambient sensor header but no clue sorry. You might try splicing off the part or hotend fan? If you really wanted to use the dc input you might need a voltage step down buck converter or something depending on what your PSU is putting out
Pi’s are usually 5vs, they won’t drive a 24v fan happily at all.
At that point what you can do is a power relay- like how most bed heaters work. That could be controlled by a pi, but delivers power from a 24v source.
Powering the fan from gpio pins probably isn't going to work out well either, they are 3.3v and 5v. Powering the fan from the PSU is going to be similar to powering a pi off it, I believe you should step the voltage down to what each needs, where the fan is 24v I think the pi is 5v. Your PSU is probably 115 or 220 v. For connectors I would expect to have to redo them yourself with micro fit, molex, jst or w/e you want and can get. On some of mine I just did single pin molex on the pins of the white female connector for fan headers, it doesn't lock but it works if you don't have a lot of movement. This page is awesome for connectors info https://www.mattmillman.com/info/crimpconnectors/common-jst-connector-types/
Honestly if your going to go through all this effort to make this work, and already have a pi, I would suggest instead upgrade the control board to something with extra fan headers, led heads, etc and switch to klipper, there have to be guides out there for your specific printer
That side of the PSU power cables will be unfused- or at least, fused on the AC supply side of the PSU which will happily set low voltage wires in fire before popping.
Yes you can hook them there, but you MUST add an inline fuse of some form to the fan leads.
A quick search for 2 channel 24v fan controller yealded the below link. Not saying this is ideal for your scenario but something similar will work and can be powered with a power brick. Doesn't look like it comes with instructions though so I'm not sure what current it requires.
The temperature sensor could work to make it turn on when the printer heats up as well.
You would connect both positive and negative of your fan to the PSU rail, but the positive side to the fan would need the inline fuse.
You can connect it without a fuse, it's just risky and I discourage doing that.
Those connectors would work for a secondary supply if your laptop charger is 12 volts. Most laptops charge at voltages higher than that though (15 to 20v is typical range) so read the charger spec carefully.